Configuring a Subversion server with Apache2 and DAV

Subversion is very popular software version and revision control system where developers can maintain current and previous versions development work. It’s gradually replacing the old Concurrent Versions System (CVS) and provide more sophistic set of features to developers. In this article I will explain you how to configure a Subversion (svn) server which uses Apache2 and DAV module. Also I presume that you have a running Apache2 service in your server.

First step is to install the required packages,

apt-get install subversion libapache2-svn

Next, we have to create the subversion repository structure, create a repository and provide full permission to apache user.

mkdir /var/svn/
mkdir /var/svn/active
svnadmin create /var/svn/active/repo
chown -R www-data:www-data /var/svn/active/repo
chmod -R 770 /var/svn/active/repo

Once the repository is configured, it’s time to configure apache2 service for svn access. We need to modify apache svn module (/etc/apache2/mods-available/dav_svn.conf) and enable it.

To enable the apache svn module,

cd /etc/apache2/mods-enabled
ln -s ../mods-available/dav_svn.conf
ln -s ../mods-available/dav_svn.load

Edit and add the following configuration to /etc/apache2/mods-available/dav_svn.conf

<Location /var/svn/active/repo>
DAV svn
SVNPath /var/svn/active/repo
AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
AuthzSVNAccessFile /etc/apache2/svn_user_access
SSLRequireSSL
</Location>

For better security, repository only accessible from HTTPS (SSLRequiredSSL) and only for authenticated users. User authentication details are stored in “/etc/apache2/dav_svn.passwd” and authorization details are located in “/etc/apache2/svn_user_access”.

To create an authorized users “momo” and “mimi”

cd /etc/apache2
htpasswd -c dav.passwd momo
htpasswd dav.passwd mimi

Note: htpasswd require “-c” option only first time when creating a password file.

Then provide access to above authorized users (/etc/apache2/svn_user_access)

[groups]
team1 = momo, mimi

[repo:/]
@team1 = rw

Finally, restart the apache service for all the changes to take effect.

/etc/init.d/apache2 restart

www.howtoforge.com/debian_subversion_websvn

3 thoughts on “Configuring a Subversion server with Apache2 and DAV

Leave a Reply

Your email address will not be published. Required fields are marked *