Friday, November 11, 2011

How to install Trac on a Synology DS2011+

In a previous post, I described installing Trac on a Synology DS209+II. I recently had to migrate this installation to a Synology DS2011+ and ran into some snags. This post will help you avoid spending all the hours I did on getting it to work.

Modifying the Synology DiskStation

To be able to do anything to your DS2011+, you first have to install the ipkg bootstrap. I basically followed along with page on the synology forum Overview on modifying the Synology Server, bootstrap, ipkg etc.:

  • You need to enable ssh access to your NAS and then log in with PuTTY
  • The Synology DS2011+ has a "Marvell Kirkwood mv6282" processor, so these steps should do the trick:
cd /volume1/@tmp
chmod +x syno-mvkw-bootstrap_1.2-7_arm-ds111.xsh
sh syno-mvk-bootstrap_1.2-7_arm-ds111.xsh
rm syno-mvk-bootstrap_1.2-7_arm-ds111.xsh

After rebooting the NAS, you can enter these commands:

ipkg update
ipkg upgrade

We are now ready to start installing all the stuff needed for running Trac!

Software to install


Log on to your DS2011+ and install the following package:

ipkg install apache

Now we have a second httpd listening on port 8000. The configuration file for this instance of apache is /opt/etc/apache2/httpd.conf. You can find the log files in /opt/var/apache2/log. Also note that it is started on system boot by the script /opt/etc/init.d/S80apache. I suggest you execute this script and see if apache starts up nicely.

I ran into some problems with this installation: A syntax error on line 74 of /opt/etc/apache2/httpd.conf. Somehow apache can't load the I didn't really care and just commented out that line.


Create a new share using the DSM (that web interface on port 5000) - call it "svn". It will show up on your box as /volume1/svn.

I mainly followed the Step-by-step guide to installing Subversion on the Synology wiki. But I didn't bother messing with inetd.conf, since I am running svn under apache with mod_dav_svn. So, that leaves the following steps:

ipkg install svn
su svnowner
cd /volume1/svn
svnadmin create testsvn

You now have a new repository on your NAS called "testsvn". You just can't access it yet - but we'll fix that next! Also note that the Step-by-step guide to installing Subversion includes a few hints on how to get su svnowner to work if you get an error message.

To get Apache to serve your subversion repository, append this to /opt/etc/apache2/httpd.conf:

# Subversion
Include etc/apache2/conf.d/mod_dav_svn.conf

You will have to create /opt/etc/apache2/conf.d/mod_dav_svn.conf of course:

LoadModule dav_svn_module     libexec/
LoadModule authz_svn_module   libexec/

<Location /svn>
   DAV svn
   SVNParentPath /volume1/svn
   AuthType Basic
   AuthName "Subversion repository"
   AuthUserFile /volume1/svn/svn-auth-file
   Require valid-user

This expects a file /volume1/svn/svn-auth-file to be present. That file contains the passwords used for Subversion (and, via Apache, Trac authentication). This file is generated with apaches htpasswd -c command. I used the cm too, to force md5 hashing of the passwords.


So far, this guide is much the same as the one it replaces. The new stuff is in the version of python used:

ipkg install python26 py26-trac py26-genshi py26-setuptools sqlite svn-py

The need for upgrading comes from the package svn-py, which is now python 2.6.

Create a share (using the DSM) called "trac-env". This is where we will keep our trac installations.

I am now running Trac version 0.12. The Trac environments can be found at /volume1/trac-env. They are called "MYTRAC1" and "MYTRAC2". Access to them is via the following URLs:

Trac is run using tracd. This is configured to start automatically on system start by creation of the following file: /opt/etc/init.d/S81trac:

# run tracd
/opt/bin/tracd -d -p 8888 -e /volume1/trac-env

The file must be set to executable for root (see documentation for chmod), so that it will be run at system start.

Trac configuration files can be found at

  • /volume1/trac-env/MYTRAC1/conf/trac.ini
  • /volume1/trac-env/MYTRAC2/conf/trac.ini

Authentication via Apache

appended following lines to /opt/etc/apache2/httpd.conf:

# Subversion
Include etc/apache2/conf.d/trac.conf

And then, create the file /opt/etc/apache2/conf.d/trac.conf:

# allow Apache to be used for authenticating Trac
<Directory /opt/share/www/trac>
   AuthType Basic
   AuthName "Subversion repository"
   AuthUserFile /volume1/svn/svn-auth-file
   Require valid-user

Authentication is done with the AccountManager plugin for trac ( The website has a good explanation on how that works. See the copies of the trac.ini files for reference. I'd like to point out the last section:

password_store = HttpAuthStore
authentication_url =

This is where we tell Trac to use our Apache Server for authentication. Note how the authentication_url is the same as the Directory in trac.conf.


Backup is still the same as in the previous post, so I'll just point you there: