Monday, May 7, 2007

Ubuntu Trac project management software setup

This is a bit of a howto for setup of Trac, with AbTLinux being the example target project that will make use of it. You can also follow the generic setup as described on the Trac site.

# first we need to install the packages.
$ sudo aptitude install trac libapache2-svn      \
libapache2-mod-python libapache2-mod-python-doc

Next we need to setup the Trac environment.
$ sudo makdir -p /var/lib/trac
$ sudo chown www-data.www-data /var/lib/trac

Now we need to setup an apache configuration with a new trac site, so add the following as /etc/apache2/sites-available/trac:

DocumentRoot /usr/share/trac/htdocs
ErrorLog /home/erics/logs/abtlinux-error_log
CustomLog /home/erics/logs/abtlinux-access_log combined
#Alias /trac-static /usr/share/trac/htdocs

SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /var/lib/trac/abtlinux
PythonOption TracUriRoot /

AuthType Basic
AuthName "AbTLinux Trac Server"
AuthUserFile /var/lib/trac/abtlinux/.htusers
Require valid-user


Now I am going to enable the new trac site (this will be pointed to with an A record as
$ sudo a2ensite trac
$ sudo  /etc/init.d/apache2 force-reload 

This is a good point to go and setup Ubuntu Apache and Subversion setup with DAV support (includes SVN migration), this will get your subversion with authentication running.

With a working installation of our project, we can finish the Trac installation which will make use of our subversion setup.

$ sudo mkdir -p /var/lib/trac
$ sudo trac-admin /var/lib/trac/abtlinux initenv
$ sudo chown -R www-data /var/lib/trac/abtlinux

After all this, I opened the trac url (in my case, and see nothing but error messages over
Traceback (most recent call last):
File "/var/lib/python-support/python2.5/trac/web/", line 387, 
in dispatch_request dispatcher.dispatch(req)
File "/var/lib/python-support/python2.5/trac/web/", line 206, 
in dispatch req.hdf = 
File "/var/lib/python-support/python2.5/trac/web/", 
line 135, in __init__ raise TracError, 
"ClearSilver not installed (%s)" % e
TracError: ClearSilver not installed 
(/usr/lib/python2.5/site-packages/ undefined symbol: 

Some research showed that this was a Feisty problem and upgrading to ClearSilver 0.10.4 solved the problem, so download this from Before building edit the file:

#  add 2.5 to variable python_versions.
python_versions="2.5 2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"

Now we need to build and install correctly.

# just build normally.
$ sudo ./configure
$sudo make
$sudo make install

# then link the to the python2.5
$ cd /usr/lib/python2.5/site-packages
$ sudo ln -s /usr/local/lib/python2.5/site-packages/

Open the Trac url ( in my case) and bingo! ;-)

As a side note, if you want to migrate Trac database data from one machine to another (as I want to here above), you need only to replace the /var/lib/trac/abtlinux/db/trac.db file with your original setup (ensure of course that your /var/lib/trac/abtlinux/conf/trac.ini file is adjusted from the defaults as needed) and resync your Trac setup as follows:

$ sudo trac-admin /var/lib/trac/abtlinux resync
$ sudo /etc/init.d/apache2 reload