Subversion setup with apache

Setting up an apache based subversion needs a little more work then doing it with a plain or svnserve setup.

My steps are described here and executed on two computers.

Create your repository

# the switch --fs-type fsfs is the default 
# but I was a little worried of getting the bdb file system
svnadmin create --fs-type fsfs demo

Make sure apache is capable of reading the repo and other cannot

# /var/lib/svn is owned by root so let www-data (apache) access the repos dir.
chmod o+rx /var/lib/svn
chmod -R o-rwx demo
chown -R www-data:www-data demo

Next create your authorization file by adding users with MD5 passwords

htpasswd -mc /etc/svn-auth-file clemens
htpasswd -m /etc/svn-auth-file test

Install and configure the modules needed for apache. On ubuntu the modules are enabled automatically.

apt-get libapache2-svn
# a2enmod dav_svn dav

Next make a svn repository available through the web

<VirtualHost svn.build2be.com:80>
  ServerAdmin webmaster@nowhere.abc

  <Location /repos>
    DAV svn
    SVNPath /var/lib/svn/apache
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile /etc/svn-auth-file
    Require valid-user
  </Location>

 ErrorLog /home/demo/log/svn_error.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog /home/demo/log/svn_access.log combined
  ServerSignature On
</VirtualHost>