Here’s a quick reference on the basics of installing Subversion on Debian using an Apache subdomain both for my own reference and others too. There were a couple of bits I had to search around for so I thought an all-in-one guide might be useful for others.
apt-get install subversion
Install Apache and the SVN module for it.
apt-get install libapache2-svn apache2
Create the subversion root directory.
mkdir -p /svn
Create a repository.
svnadmin create /svn/default
Give apache rights on the root directory and its contents.
chown -R www-data:www-data /svn
Enable dav and svn modules on Apache.
a2enmod dav a2enmod dav_svn
If you want to use a subdomain for svn like svn.example.com set up a vhost as follows.
Note: Don’t forget to replace the IP with your own.
<VirtualHost 220.127.116.11:80> ServerAdmin email@example.com ServerName svn.example.com ErrorLog /var/www/svn.example.com/logs/error.log CustomLog /var/www/svn.example.com/logs/access.log combined <Location /> DAV svn SVNParentPath /svn SVNListParentPath on AuthType Basic AuthName "Subversion Repository" AuthUserFile /auth/svn/default/htpasswd Require valid-user </Location> <Location /default> AuthType Basic AuthName "Subversion Repository" AuthUserFile /auth/svn/default/htpasswd Require valid-user </Location> </VirtualHost>
Obviously configure the above to match your requirements.
Create the Apache log directory specified above.
mkdir -p /var/www/svn.example.com/logs
Give Apache rights to the log directories you’ve set up above.
chown -R www-data:www-data /var/www/svn.example.com/logs
Create a password file with your chosen username.
htpasswd -s -c /auth/svn/default/htpasswd USERNAME
Restart apache and test your setup.
Note: The following configuration in the above vhost config specifies the location in the filesystem of a parent directory whose child directories are Subversion repositories.
Note: And the following configuration in the above vhost config allows a GET of SVNParentPath, which results in a listing of all repositories under that path. This means that you can go to svn.example.com in your browser and see a listing of repositories underneath it.
That’s it. For further details see the svn book. Thanks to the excellent library article by linode.com for providing me with a concise introduction which I could adapt for my own needs. If you are not already hosting with linode.com you should be. They are the best hosting provider in the world.
Was this post helpful to you? Please let me know in the comments!