Trac has a lot of complex dependencies and contrary to what the TracInstall page says it is one hell of a painful job installing it in a shared server under one’s own home directory. This is a step-by-step guide of how I made it work and the mileage will vary greatly on the version you try to use. If this guide was helpful or needs corrections, please let me know.
Now lets get on with it… I found the following pages useful for the install:
http://projects.edgewall.com/trac/wiki/TracInstall
http://wiki.dreamhost.com/index.php/Trac
Note:All of my installs follow the same pattern. Untar the distribution into a [tool]-[version]-dist directory and install to $HOME/[tool]-[version] and create a symlink to $HOME/[tool]. This allows me to easily upgrade individual pieces without breaking others (I simply symlink to the new version when its time to upgrade).
Installing Trac’s dependencies:
1. Python (version 2.4) : Eventhough you might have Python in your shared server , you need your own version because of ClearSilver.
$ wget http://www.python.org/ftp/python/2.4.2/Python-2.4.2.tgz
$ gunzip Python-2.4.2.tgz; tar xvf Python-2.4.2.tar;
$ mv python-2.4.2 python-2.4.2-dist
$ cd python-2.4.2-dist
$ ./configure –prefix=$HOME/python-2.4.2
$ make; make install
$ ln -sf $HOME/python-2.4.2 $HOME/python
IMPORTANT: Add $HOME/python/bin to the start of your PATH variable and LD_LIBRARY_PATH in your shell. If you use bash, set it in .bashrc as follows:
export LD_LIBRARY_PATH=$HOME/python/lib/
PATH=$HOME/python/bin:$PATH:$HOME/ruby/bin:$HOME/subversion/bin
2. Installing ClearSilver (0.10.2):
$ wget http://www.clearsilver.net/downloads/clearsilver-0.10.2.tar.gz
$ gunzip clearsilver-0.10.2.tar.gz; tar xvf clearsilver-0.10.2.tar
$ mv clearsilver-0.10.2 clearsilver-0.10.2-dist
$ cd clearsilver-0.10.2-dist
$ ./configure –prefix=$HOME/clearsilver-0.10.2 –with-python=$HOME/python/bin/python –disable-ruby –disable-java –disable-perl –disable-csharp
$ make ; make install –prefix=$HOME/clearsilver-0.10.2
3. Install egenix extensions for python (2.0.6: Trac needs mxDateTime)
$ wget http://www.egenix.com/files/python/egenix-mx-base-2.0.6.tar.gz
$ gunzip egenix-mx-base-2.0.6.tar.gz
$ tar xvf egenix-mx-base-2.0.6.tar
$ cd egenix-mx-base-2.0.6
$ python setup.py build
$ python setup.py install —prefix=$HOME/python
4. Install sqlite (version 3.2.2)
$ wget http://www.sqlite.org/sqlite-3.2.2.tar.gz
$ gunzip sqlite-3.2.2.tar.gz
$ tar xvf sqlite-3.2.2.tar
$ mv sqlite-3.2.2 sqlite-3.2.2-dist
$ cd sqlite-3.2.2-dist
$ ./configure –prefix=$HOME/sqlite-3.2.2
$ edit Makefile to remove references to build and install tclsqlite since I did not have TCL installed
all: sqlite3.h libsqlite3.la sqlite3$(TEXE) $(HAVE_TCL:1=libtclsqlite3.la) -to-
all: sqlite3.h libsqlite3.la sqlite3$(TEXE)
-and-
install: sqlite3 libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install} -to-
install: sqlite3 libsqlite3.la sqlite3.h
$ make ; make install –prefix=$HOME/sqlite-3.3.2
$ ln -sf $HOME/sqlite-3.3.2 $HOME/sqlite
4. Install PySqlite (version 1.1.6) (I could not get PostgresSQL to work with Trac because my ISP does not start the postgresSQL daemon to accept TCP/IP connections):
$ wget http://initd.org/pub/software/pysqlite/releases/1.1/1.1.6/pysqlite-1.1.6.tar.gz
$ gunzip pysqlite-1.1.6.tar.gz
$ tar xvf pysqlite-1.1.6.tar
$ mv pysqlite pysqlite-1.1.6
$ cd pysqlite-1.1.6
$ edit setup.py and change the following:
include_dirs = ['/usr/include/sqlite']
library_dirs = ['/usr/lib/']
-to-
include_dirs = ['/path/to/homedir/python/include/sqlite']
library_dirs = ['/path/to/homedir/python/lib/']
$ python setup.py build
$ python setup.py install
5. Install Subversion (Skipping this section) : See my previous post on how to install subversion.
I still had to do the following to get python bindings for SVN in my subversion-1.1.4-dist directory:
$ ./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
## HACK WARNING ### I also had copy some of the svn libraries from the original python install at my ISP:
$ cd $HOME/python/lib/python-2.4/site-packages
$ cp -R /usr/lib/python2.3/site-packages/libsvn .
$ cp -R /usr/lib/python2.3/site-packages/svn .
6. Install SWIG (version 1.3.24):
$ 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-dist
$ cd swig-1.3.24-dist/
$ ./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
Installing TRAC
Now to the real reason we went through all this pain… installing trac itself
$ wget http://ftp.edgewall.com/pub/trac/trac-0.9.3.tar.gz
$ gunzip trac-0.9.3.tar.gz
$ tar xvf trac-0.9.3.tar
$ mv trac-0.9.3 trac-0.9.3-dist
$ cd trac-0.9.3-dist
$ python setup.py build
$ python setup.py install –prefix=$HOME/python
Create a trac environment and test
$ trac-admin $HOME/trac-projects initenv
answer the questions as part of the above command. You will need to pay close attention only to the location of your svn repository , in my case it is $HOME/svn.
Your Trac install is DONE.
Now to access this through a browser. Do the following in your public_html directory:
$ mkdir $HOME/public_html/trac
$ cd trac
# create a projects.cgi with the following content:
#!/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:
AuthType Basic
AuthName “Log in to Trac. guest access use (guest/guest) as userid/password”
DirectoryIndex projects.cgi
$ ln -sf $HOME/python/share/trac/htdocs trac-static
# edit $HOME/trac-projects/conf/trac.ini and add the following under [trac]
htdocs_location = /trac-static
Now go to http://[your-domain]/trac and you should see something like this (login as guest/guest: http://trac.chandraonline.net/
Great Tutorial!
You have a typo in step 3, last line:
$ python setup.py install –prefix=$HOME/python
prefix should have double dash –prefix
Not a biggie of course, but just if someone wonders
Useful pieces of information. Boy, Trac is such a PITA for installation. I installed it just because it has the best usability and looks. I could not get the python bindings for svn to work correctly.
Get rid of the –disable-shared while configuring subversion, and the python binding s start working…
of course, i had to copy stuff over from svn-python/ to python2.4/site-packages/ to get python to find the module. (i could have used PYTHONPATH as well, i guess)
Pingback: Nathaniel Brown’s Blog » Blog Archive » Trac and Subversion on Site5
Thanks for the detailed documentation. Finally got trac to install after 4 days of configuration hell on a shared server. Couple of changes I had to make to get my install to work:
Step 4:
include_dirs = ["/path/to/homedir/python/include/sqlite"]
library_dirs = ["/path/to/homedir/python/lib/"]
I had to point to sqlite/include and sqlite/lib respectively.
And the last step for me was copying file /clearsilver-0.10.2-dist/python/neo_cgi.so to /python/lib/python2.4/site-packages.
Pingback: Arbonne Skin Care medicine
Pingback: Printable Paper dolls
Pingback: tobacco statistics