How to set up SVN on Debian Squeeze

Thanks to:

Although there are plenty of guides available on the internet regarding this issue. I found that most led me into trouble. These are the steps that worked for me. Things may differ for you. While there are plenty of secure installation articles out there such as SSH+SVN. However, I’m only using SVN internally and for my needs, ssh+svn takes away too much functionality to make it worth it. This article steps through installing a simple http installation but it shouldn’t take much to set up ssl and use https instead.

The first step is to make sure you have the required packages installed.

$ sudo aptitude install subversion libapache2-svn

Then you’ll want to create the directory where you want the repositories to live.

$ sudo mkdir /var/svn
$ sudo chown -R www-data:www-data /var/svn

Open up dav_svn.conf in your favorite text editor.

$ sudo vi /etc/apache2/mods-available/dav_svn.conf

Uncomment the following lines.

<Location /svn>
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user

Now enable the dav_svn module and restart Apache

$ sudo a2enmod dav_svn
$ service apache2 restart

Create the first user account

$ sudo htpasswd -c /etc/apache2/dav_svn.passwd user

Finally, time to test the whole thing.

$ sudo svnadmin create /var/svn/test
$ sudo chown -R www-data:www-data /var/svn/test

And try to check it out. Remember to enter your local password first and then when prompted, enter your svn user and password.

$ svn co http://localhost/svn/test

If everything works ok, congratulations! You now have an SVN server ready to go. If you want to remove the test repository, simply delete it like you would any other directory.