Monday, January 23, 2012

Configuring svnweb for apache

I'm currently looking for a suitable web interface to a svn repository. There are several available in Ubuntu so that makes the job a bit easier, but it was not a totally smooth experience.

svnweb looks pretty promising with the right functions easily available. But it wasn't all that trivial to install. The first try:

  apt-get install libsvn-web-perl

I need to make a server root and populate it:

  mkdir /var/www-svnweb
  cd /var/www-svnweb

then edit config.yaml in the obvious ways.  But it fails, /usr/bin/svnweb-server throws errors about format.number and somesuch.  Some googeling reveals this to be needed:

  apt-get install libnumber-format-perl libtemplate-plugin-number-format-perl

Then I quickly got tired of running the server as a standalone process, I'd rather have it in the apache server on the machine.  The Ubuntu package does not contain any configuration templates or examples, so I found the origin package and had a look in the tar.gz distribution.  It did have a template. I want the service as a separate virtual server so I have to adapt some:

             DocumentRoot /var/www-svnweb

             ErrorLog /var/log/apache2/rancid-svnweb-error.log

             LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
             LogFormat "%h %l %u %t \"%r\" %>s %b" common
             LogFormat "%{Referer}i -> %U" referer
             LogFormat "%{User-agent}i" agent

             CustomLog /var/log/apache2/rancid-svnweb.log common

                        AllowOverride None
                        Options None
                        SetHandler perl-script
                        PerlHandler SVN::Web

                        SetHandler default-handler

From the template I can see that mod_perl is needed.

  apt-get install libapache2-mod-perl

Trying to view the site did not render any useful results, and no log messages in the error log. So I had to go to the "root" apache error log and found messages about missing Apache2/

  apt-file search Apache2/

reveals the package containing that.  And a small test shows that the package must also be enabled in apache.

  apt-get install libapache2-request-perl
  a2enmod apreq

And then it's working.