Dave Perrett

Installing Trac

database, linux, programming, python, version control, web

Before you do anything, Install Subversion .

Install Python :

1
2
3
4
5
6
$ wget http://www.python.org/ftp/python/2.5/Python-2.5.tgz
$ tar xvzf Python-2.5.tgz
$ cd Python-2.5
$ ./configure
$ make
$ sudo make install

Make sure we are using the right python executable :

1
2
3
$ sudo rm -Rf /usr/bin/python
$ sudo ln -s /usr/local/bin/python /usr/bin/python
$ sudo /sbin/ldconfig

Install Tkl :

1
2
3
4
5
6
7
8
* wget http://jaist.dl.sourceforge.net/sourceforge/tcl/tcl8.5a5-src.tar.gz
$ tar xvzf tcl8.5a5-src.tar.gz
$ cd tcl8.5a5-src
$ cd unix
$ ./configure
$ make
$ sudo make install
$ sudo /sbin/ldconfig

Install SQLite :

1
2
3
4
5
6
7
8
$ wget http://www.sqlite.org/sqlite-3.3.13.tar.gz
$ tar xvzf sqlite-3.3.13.tar.gz
$ mkdir bld
$ cd bld
$ ../sqlite-3.3.13/configure --prefix=/usr/local
$ make
$ sudo make install
$ sudo /sbin/ldconfig

Install PySQLite :

1
2
3
4
5
6
$ wget http://initd.org/pub/software/pysqlite/releases/2.1/2.1.3/pysqlite-2.3.3.tar.gz
$ tar xvzf pysqlite-2.3.3.tar.gz
$ cd pysqlite-2.3.3
$ sudo python setup.py build
$ sudo python setup.py install
$ sudo /sbin/ldconfig

Install SilverCity :

1
2
3
4
5
6
$ wget http://jaist.dl.sourceforge.net/sourceforge/silvercity/SilverCity-0.9.7.tar.gz
$ tar xvzf SilverCity-0.9.7.tar.gz
$ cd SilverCity-0.9.7
$ python setup.py build
$ sudo python setup.py install
$ sudo /sbin/ldconfig

Install ClearSilver :

1
2
3
4
5
6
7
8
$ wget http://www.clearsilver.net/downloads/clearsilver-0.10.4.tar.gz
$ tar xvzf clearsilver-0.10.4.tar.gz
$ cd clearsilver-0.10.4
$ ./configure
$ make
$ sudo make install
$ sudo cp python/neo_cgi.so /usr/local/lib/python2.5/site-packages/
$ sudo /sbin/ldconfig

Install Trac :

1
2
3
4
5
6
7
8
9
10
$ wget http://ftp.edgewall.com/pub/trac/trac-0.10.3.tar.gz
$ tar xvzf trac-0.10.3.tar.gz
$ cd trac-0.10.3
$ sudo python ./setup.py install
$ sudo mkdir /home/svn/trac/my_project
$ sudo trac-admin /home/svn/trac/my_project initenv
  Project Name [My Project]> My Project
  Database connection string [sqlite:db/trac.db]> (just hit enter)
  Path to repository [/var/svn/test]> /home/svn/repositories/my_project
$ sudo chmod -R a+rw /home/svn/trac/my_project/db

Configure Apache - add something similar to the following to httpd.conf :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<virtualHost xxx.xxx.xxx.xxx>
  DocumentRoot /usr/local/apache-2.2.4/trac
  ServerName trac.domain.name.here

  RewriteEngine on
  RewriteRule ^/+$                     /index.html [L]
  RewriteCond /home/svn/trac/$1        -d
  RewriteRule ^/([[:alnum:]_]+)(/?.*)  /trac.cgi$2 [S=1,E=TRAC_ENV:/home/svn/trac/$1]
  RewriteRule ^/(.*)                   /index.html

  Alias /trac/ /usr/share/trac/htdocs/
  #or where you installed the trac htdocs

  #You have to allow people to read the files in htdocs
  <directory "/usr/share/trac/htdocs">
        Options Indexes MultiViews
        AllowOverride All
        order deny,allow
        Allow from all
  </directory>

  <directory "/usr/local/apache-2.2.4/trac">
        AllowOverride All
        Options Indexes FollowSymLinks
        Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
        AddHandler cgi-script .cgi
        order deny,allow
        Allow from all
        AuthType Basic
        AuthName "Private Repository"
        AuthUserFile /usr/local/apache-2.2.4/passwd/passwords
        Require valid-user
  </directory>

  <locationMatch "/[[:alnum:]_]+">
       AuthType Basic
       AuthName "Private Repository"
       AuthUserFile /usr/local/apache-2.2.4/passwd/passwords
       Require valid-user
  </locationMatch>

</virtualHost>

Swap the xxx.xxx.xxx.xxx with your server’s IP address, and the trac.domain.name.here with your domain. Also make sure that httpd.conf is setup to run apache as the ‘svn’ user.

If you have trouble getting the svn-python bindings to work (if this is the case you will get an unsupported repository type “svn” or something similar in trac), check the subversion Makefile and make sure the python binary and library paths are correct. I had to do the following when building subversion (after ./configure) to fix them:

1
2
3
sed -ri "s|PYTHON = /usr/bin/python2|PYTHON = /usr/local/bin/python|" Makefile
sed -ri "s|/usr/include/python2.2|/usr/local/include/python2.5|" Makefile
sed -ri "s|SVN_APR_LIBS =  /usr/local/apache-2.2.4/lib/libapr-1.la -luuid -lrt -lcrypt  -lpthread -ldl|SVN_APR_LIBS =  /usr/local/apache-2.2.4/lib/libapr-1.la -luuid -lrt -lcrypt  -lpthread -ldl -L/usr/kerberos/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lexpat|" Makefile

The extra SVN_APR_LIBS arguments (-L/usr/kerberos/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lexpat) were obtained using the output of :

1
$ /usr/local/bin/neon-config --libs