I just completed setting up an SVN repository on my Ubuntu server. I didn’t like the idea of a /repos virtual directory and wanted to install it on a subdomain – luckily this was a fairly easy thing to do.
1. First of all set up a config file for your virtual host, usually in /etc/apache2/sites-available/. You can just copy the existing default file and use that as a template if you’d like.
# use the default file
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/repository
# edit it with your favourite editor
2. Remove the usual DocumentRoot as you won’t need it (DAV_Svn will serve the content)
3. Set up your servername i.e. repos.danielbyrne.net in my case
4. Set up a virtual directory using the ‘Location’ config section in your virtual host file (I just used / so the subdomain would point directly to the repository)
# Uncomment this to enable the repository
# Path to your repository
# Authentication – basic authentication using htpasswd in this case
AuthName “Subversion Repository”
# Users must be authenticated to commit to the repository, anonymous users can view
<LimitExcept GET PROPFIND OPTIONS REPORT>
5. enable your new virtual host
sudo a2ensite examplesite
sudo /etc/init.d/apache2 reload
NOTE: this implies that you have already installed both SVN and Apache.
If you want to use the basic authentication specified above, run:
htpasswd /etc/apache2/dav_svn.passwd username
… and enter a password for the user you specified