Subversion (SVN) with WebSVN, DAV and Apache2 under Ubuntu

Install Subversion:

Use the following command to install Subversion and the Apache2 module:

sudo apt-get install subversion libapache2-svn

Create a repository:

Use the following command to create a repository:

sudo svnadmin create /var/svn/new-project/

Add permission to the directory for the Apache user only:

chmod -R 775 /var/svn/new-project

chown -R www-data:www-data /var/svn/new-project

Configure Apache

Open /etc/apache2/mods-available/dav_svn.conf and add a new “virtual directory”:

<location /svn>
DAV svn

SVNParentPath /var/svn

AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd

AuthzSVNAccessFile /etc/apache2/dav_svn.authz

Require valid-user

</location>

Create the users password file. Use the following command the first time only, the -c parameter will create AND override the file if it exists:

htpasswd2 -c /etc/apache2/dav_svn.passwd username

To add other users or change password use:

htpasswd2 -m /etc/apache2/dav_svn.passwd username

In /etc/apache2/dav_svn.authz, add the users permissions

[/]
me=rw

[new-project:/]
other.user=rw

Finally, restart Apache so that the changes take effect:

apache2ctl restart

Leave a Reply