Installing SVN and trac on Raspberry Pi

This post is step by step instructions for installing subversion (SVN) 1.8.10 and trac on the Raspberry Pi. I am writing it as a reminder to myself, but if you find it useful…

Beforehand

It’s a good idea to get up to date

sudo apt-get update
sudo apt-get upgrade

Install Subversion

First of all I checked the version included in the raspbian distribution, and I wanted a later version. I looked at using the WANdisco binaries, but found that they seemed to be missing the binaries required for the raspberry pi. So these instructions use the debian backports.

I followed these instructions. First I added wheezy-backports to me sources.list by creating /etc/apt/sources.list.d/wheezy-backports.list

deb http://http.debian.net/debian wheezy-backports main

I tried just running sudo apt-get update, however I got the following error

W: GPG error: http://http.debian.net wheezy-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010

After a little digging I found that I could add the public keys like this

It is important to note two things here. Firstly, if you add more than one user omit the -c on all subsequent calls as this creates the digest file and so would delete all existing users. Secondly the “Subversion Repo” argument specifies the realm and must match the AuthName in dav_svn.conf.

Now is a good time to test that it is working: browse to http://192.168.0.34/svn/play (the ip address of your RPi), you should be prompted for a username and password, enter the ones you specified when creating the digest and you should be in.

One last step is to tie down the native file access permissions, and to grant the apache user address to write to the repository.

sudo chown -R www-data:www-data /var/svn/repos

Install trac

With trac I have decided to install the version bundled with raspbian (0.12.5). I based the decision on the availability of other trac plugins, also for compatibility with subversion 1.8 I need trac >=0.12.3.

sudo apt-get install trac

sudo apt-get install lib-apache2-mod-python

Configure trac

I want trac to share the same digest authentication as subversion. I also want a separate trac database for my play and prod repositories. The steps below only show the setup for the play repository.

sudo mkdir /var/trac

sudo mkdir /var/trac/projects

sudo chown -R www-data:www-data /var/trac/projects

Edit the apache configuration

sudo vi /etc/apache2/sites-enabled/000-default

Add the following to the end of the file, just before the </VirtualHost> tag. Note that the authentication matches the subversion settings.

You get asked a few questions, I responded play for the name of the project and accepted all other defaults.
Restart apache

sudo /etc/init.d/apache2 restart

Time to test, browse to http://192.168.0.34/trac/ (use the IP address of your RPi) you should see a list of your trac projects.

Click on the play project name and you should see trac

NOTE: According to TracAuthenticationIntroductionNote that in the current version of Trac, clicking on the logout link above the navigation bar does not logs user out because the browser still remembers the HTTP authentication and keeps sending it.

To be able to administer trac add a user as the trac admin. I use my normal trac login.