June 27, 2009
Toolbox
  • PDF
  • Print
  • Listen

Trac on shared server:installation

Trac is undoubtedly one of the most issue/bug tracking and project management software to date. Trac installation is far more complex and tiresome than what TracInstall page says it is. First of all it got a huge list of very complex dependencies that can take up your whole day to take care. It’s more painful when it comes to shared hosting installation; I do understand the fact most shared hosting doesn’t even give SSH access. Recently when I was installing Trac for a client came across with tons of issues and had to device a long list of to-dos to take care of the situation. So without further due let’s get on with how we can install Trac over shared hosting (considering it got the SSH access).

Trac_Logo_512x512 First we have to install Trac dependencies, some/most may or may not be already installed on your web server’s root but we will need our own editions to make all the things work together.

Installing Dependencies
a. Python (=>v 2.3 and <v3.0)
According to Trac documentation the recommended version of Python for Trac is above v2.3 and Bellow v3.0. So for example let’s go for version 2.5.

1
2
3
4
5
6
7
$ wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz
$ gunzip Python-2.5.2.tgz; tar xvf Python-2.5.2.tar;
$ mv python-2.5.2 python-2.5.2-src
$ cd python-2.5.2-src
$ ./configure –prefix=$HOME/python-2.5.2
$ make; make install
$ ln -sf $HOME/python-2.5.2 $HOME/python

IMPORTANT: Considering you are using bash, set in .bashrc as follows (without this step the Python installation wont be complete):

1
2
export LD_LIBRARY_PATH=$HOME/python/lib/
PATH=$HOME/python/bin:$PATH:$HOME/ruby/bin:$HOME/subversion/bin

b. Clearsilver (0.10.5)-it’s optional, some major plug-in requires it

1
2
3
4
5
6
$ wget http://www.clearsilver.net/downloads/clearsilver-0.10.5.tar.gz
$ gunzip clearsilver-0.10.5.tar.gz; tar xvf clearsilver-0.10.5.tar
$ mv clearsilver-0.10.5 clearsilver-0.10.5-src
$ cd clearsilver-0.10.5-src
$ ./configure –prefix=$HOME/clearsilver-0.10.5 –with-python=$HOME/python/bin/python –disable-ruby –disable-java –disable-perl –disable-csharp
$ make ; make install –prefix=$HOME/clearsilver-0.10.5

c. eGenix extensions for python (3.1.2)

1
2
3
4
5
6
$ wget http://downloads.egenix.com/python/egenix-mx-base-3.1.2.tar.gz
$ gunzip egenix-mx-base-3.1.2.tar.gz
$ tar xvf egenix-mx-base-3.1.2.tar
$ cd egenix-mx-base-3.1.2
$ python setup.py build
$ python setup.py install —prefix=$HOME/python

d. Swig (version 1.3.24)

1
2
3
4
5
6
7
8
$ wget http://easynews.dl.sourceforge.net/sourceforge/swig/swig-1.3.24.tar.gz
$ gunzip swig-1.3.24.tar.gz
$ tar xvf swig-1.3.24.tar
$ mv SWIG-1.3.24/ swig-1.3.24-src
$ cd swig-1.3.24-src/
$ ./configure –prefix=$HOME/swig-1.3.24 –with-python=$HOME/python/bin/python
$ make; make install
$ ln -sf $HOME/swig-1.3.24/ $HOME/swig

I am skipping the Database installation (since SQlite 3.3.4 is preinstalled at Python 2.5.2) as well as subversion installation since it’s not mandatory for Trac (but you have to apply following commands if you want to use subversion with Trac).

1
2
3
4
$ ./configure PYTHON=$HOME/python/bin/python –prefix=$HOME/subversion –with-swig=$HOME/swig/bin/swig –without-berkeley-db –with-ssl –with-zlib –disable-shared
$ make
$ make swig-py
$ make install-swig-py

Installing Trac itself
Now that all required dependencies installed, now let’s get down to the real deal that is the Trac installation itself.

1
2
3
4
5
6
7
8
$ wget http://ftp.edgewall.com/pub/trac/Trac-0.11.4.tar.gz
$ gunzip trac-0.11.4.tar.gz
$ tar xvf trac-0.11.4.tar
$ mv trac-0.11.4 trac-0.11.4-src
$ cd trac-0.11.4-src
$ python setup.py build
$ python setup.py install –prefix=$HOME/python
$ trac-admin $HOME/trac-projects initenv

Now just provide the details asked in response to above command. If you are using subversion please pay close attention to the location of your svn repository.

Now that your Trac installation is done, we need to prepare it to access this through a browser. In public_html or httpdocs or similar directory:

1
2
$ mkdir $HOME/public_html/trac
$ cd trac

# create a projects.cgi with the following content:

1
2
3
4
5
#!/bin/bash
export LD_LIBRARY_PATH=”/path/to/home/python/lib”
export TRAC_ENV=”/path/to/home/trac-projects”
/path/to/home/python/share/trac/cgi-bin/trac.cgi
$ chmod +x projects.cgi

# create a .htaccess file:

1
2
3
4
5
AuthType Basic
AuthName “Log in to Trac. guest access use (guest/guest) as userid/password”
require valid-user
AuthUserFile /path/to/home/htpassword/file
DirectoryIndex projects.cgi

#on command line

1
$ ln -sf $HOME/python/share/trac/htdocs trac-static

# edit $HOME/trac-projects/conf/trac.ini and add the following under [trac]

1
htdocs_location = /trac-static

That should be enough to have your Trac up, running and accessible through web browser. Lost? You can get preety good basic idea on platform specific installation guide over Trac Docs.

 
blog comments powered by Disqus