User Tools

Site Tools


trac_installation
Trac Installation Process for wiki.cs.purdue.edu
Ethan Blanton <eblanton@cs.purdue.edu>
2007-09-30


In these instructions, I will use a number of variables to represent
paths and other configuration information.  Because syntax and power
of the formats concerned vary, the variables will be used as bare
identifiers; replace them as necessary.

HOME                := your home directory
TRAC_INSTALL_PREFIX := the location where trac and its dependencies
                       are to be installed; I used ${HOME}/trac.
TRAC_ENVIRONMENTS   := the directory from where the various trac
                       environments are to be served; I used
                       TRAC_INSTALL_PREFIX/environments.
CURRENT_ENVIRONMENT := location of the environment we're currently
                       dealing with; again, for me, this was
                       TRAC_ENVIRONMENTS/rocs.
TRAC_URL_PATH       := The base path of trac on your web server;
                       I used /rocs/trac.  (Note the lack of a
                       trailing slash; this is important for the
                       rewrite rule in the Apache config.)


1) Prepare your environment

   The following definitions will need to be in your environment, for
   the build to proceed:

     LD_LIBRARY_PATH=/opt/csw/lib
     PYTHONPATH=TRAC_INSTALL_PREFIX/lib/python2.3/site-packages
     PATH=${PATH}:TRAC_INSTALL_PREFIX/bin

   Make sure they are exported.


2) Install trac dependencies

   * pysqlite2

     I used pysqlite2 2.3.5.  This was as simple as downloading and
     extracting it, then running:

       python setup.py install --prefix=TRAC_INSTALL_PREFIX

   * ClearSilver

     This is a little bit of a pain in the butt, and the trac people
     know it; it will go away for trac 0.11.  In the meantime, I
     used 0.10.5, and built it more or less following the
     instructions currently available at:

       http://systemsadmin.info/solaris/articles/building-trac-on-solaris

     What I actually used was:

       ./configure --prefix=TRAC_INSTALL_PREFIX \
                   --with-python=/opt/csw/bin/python --disable-apache \
                   --disable-perl --disable-ruby --disable-java \
                   --disable-csharp

     Edit the rules.mk created by this configure to add '-mimpure-text'
     to the LDSHARED definition, the INSTALL path to be relative to
     NEOTONIC_ROOT, and the python site directory to be within our local
     install.  Edit these definitions in place in the existing rules.mk,
     do not add them at the top/bottom/etc.  For me, this yielded:

       LDSHARED   = $(CC) -shared $(PICFLG) -mimpure-text

       INSTALL    = $(NEOTONIC_ROOT)/install-sh -c

       PYTHON_SITE = $(PREFIX)/lib/python2.3/site-packages

     Now, run 'gmake'.  It should complete without errors.  Assuming it
     does, run 'gmake install'.


3) Install trac itself

   I installed 0.10.4.  This was a simple process:

     python setup.py build
     python setup.py install --prefix=TRAC_INSTALL_PREFIX

   We will also need the trac.cgi from the install directory; I put it
   in ${HOME}/cgi-bin, although this is not entirely necessary:

     cp TRAC_INSTALL_PREFIX/share/trac/cgi-bin/trac.cgi ${HOME}/cgi-bin


4) Create a trac environment

   This process creates the trac environment; if you want to serve more
   than one trac, this is the part you do more than once.  Your apache
   config would also have to change for that, but such changes will not
   be covered here.  Run the following:

     trac-admin CURRENT_ENVIRONMENT initenv
     mkdir CURRENT_ENVIRONMENT/eggcache

   Answer the initenv questions appropriately; if you are not going to
   be hooking your trac to a subversion repository (I am not), you can
   leave those questions unchanged.


5) Configure apache to serve trac

   I created a trac.conf in ${HOME}/apache/conf, which I then simply
   included from the bottom of httpd.conf.  It contains:

     Alias TRAC_URL_PATH/chrome/common CURRENT_ENVIRONMENT/htdocs

     ScriptAlias TRAC_URL_PATH/ HOME/cgi-bin/trac.cgi/
     RewriteEngine on
     RewriteRule ^TRAC_URL_PATH$ TRAC_URL_PATH/ [R]

     <Location "TRAC_URL_PATH">
         SetEnv LD_LIBRARY_PATH "/opt/csw/lib"
         SetEnv PYTHONPATH "TRAC_INSTALL_PREFIX/lib/python2.3/site-packages/"
         SetEnv TRAC_ENV "CURRENT_ENVIRONMENT"
         SetEnv PYTHON_EGG_CACHE "CURRENT_ENVIRONMENT/eggcache/"
     </Location>

     <Directory "CURRENT_ENVIRONMENT/htdocs">
         Order allow,deny
         Allow from all
     </Directory>

   Restart Apache or send it SIGUSR1, and you should be good to go.
trac_installation.txt · Last modified: 2007/11/18 15:31 by jtkorb