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
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
gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553 gpg -a --export 8B48AD6246925553 | sudo apt-key add - gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010 gpg -a --export 7638D0442B90D010 | sudo apt-key add - sudo apt-get update sudo apt-get -t wheezy-backports install subversion
Now it is possible to update with no errors
sudo apt-get update
Finally we can install subversion
sudo apt-get -t wheezy-backports install subversion
sudo apt-get -t wheezy-backports install python-subversion
(Note: originally I missed python-subversion, this left a version mismatch and caused errors)
Now check the version installed
svn --version
Install Apache
I have decided that I am less likely to get conflicts if the versions of apace and subversion come from the same distribution. So I install from wheezy backports.
sudo apt-get -t wheezy-backports install apache2
sudo apt-get -t wheezy-backports install libapache2-svn
I got a single warning during install
I have chosen to ignore this for now. To test the installation of apache I browsed to http://localhost/
Create Repositories
sudo mkdir /var/svn
sudo mkdir /var/svn/repos
sudo svnadmin create /var/svn/repos/play
Configure Security
sudo vi /etc/apache2/mods-available/dav_svn.conf
<Location /svn> DAV svn SVNParentPath /var/svn/repos AuthType Digest AuthName "Subversion Repo" AuthUserFile /etc/apache2/dav_svn.htdigest Require valid-user </Location>
sudo a2enmod auth_digest sudo service apache2 restart
sudo htdigest -c /etc/apache2/dav_svn.htdigest "Subversion Repo" david
sudo chown -R www-data:www-data /var/svn/repos
Install trac
sudo apt-get install trac
sudo apt-get install lib-apache2-mod-python
Configure trac
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.
<Location /trac> SetHandler mod_python PythonInterpreter main_interpreter PythonHandler trac.web.modpython_frontend PythonOption TracEnvParentDir /var/trac/projects PythonOption TracUriRoot /trac PythonOption PYTHON_EGG_CACHE /tmp AuthType Digest AuthName "Subversion Repo" AuthDigestDomain /trac AuthDigestProvider file AuthUserFile /etc/apache2/dav_svn.htdigest Require valid-user </Location>
Now it is time to create the play trac project environment
sudo -u www-data trac-admin /var/trac/projects/play initenv
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.
NOTE: According to TracAuthenticationIntroduction Note 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.
sudo -u www-data trac-admin /var/trac/projects/play permission add david TRAC_ADMIN
For further configuration to make the integration tighter and to improve performance see