I needed to install Trac on an RHEL5 system. This was a bit of a problem since it needed a version of python with threads and the version from RedHat does not have threads. We also have ldap set up for authentication and I wanted Trac to be able to use it.

  1. Compile and install sqlite3.
    ./configure
    make
    make install
    (puts in under /usr/local)
  2. Compile and install subversion (it requires sqlite3, which is why I did that first)
    ./configure
    make
    make install
  3. Compile and install python2.6. RHEL uses the python installed in the system, so installing 2.6 in /usr/local solves our problem.
    ./configure –with-threads –enable-shared
    make
    Here I get these errors:

    Failed to find the necessary bits to build these modules:
    bsddb185           dl                 imageop         
    sunaudiodev     
    

    If you get errors for other packages here, you should be able to install the development package from RedHat to fix those. For the packages listed above, edit setup.py and comment out the sections having to do with these.
    make install

    • Create the file /etc/ld.so.conf.d/libpython2.6.conf and put the following line in it:
      /usr/local/lib
      

      Then run ldconfig

    • Install setuptools
      wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
      [~]# sh setuptools-0.6c11-py2.6.egg
      Processing setuptools-0.6c11-py2.6.egg
      Copying setuptools-0.6c11-py2.6.egg to /usr/local/lib/python2.6/site-packages
      Adding setuptools 0.6c11 to easy-install.pth file
      Installing easy_install script to /usr/local/bin
      Installing easy_install-2.6 script to /usr/local/bin
      
      Installed /usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
      Processing dependencies for setuptools==0.6c11
      Finished processing dependencies for setuptools==0.6c11
      
  4. mod_wsgi module
    ./configure –with-python=/usr/local/bin/python2.6
    make
    make install
    (The httpd module is installed in /usr/lib64/httpd/modules)
  5. If not installed, use yum to install httpd. And get it running.
  6. Install Trac
    • easy_install Babel==0.95
    • easy_install Trac
  7. Setup Trac
    • trac-admin /net/web/lappd-trac/LAPPD initenv
      Project name> LAPPD
      Database connection string> sqlite:db/trac.dbj
    • # trac-admin /net/web/lappd-trac/LAPPD deploy /tmp/deploy
      Copying resources from:
        trac.web.chrome.Chrome
          /root/.python-eggs/Trac-0.12.2-py2.6.egg-tmp/trac/htdocs
          /net/web/lappd-trac/LAPPD/htdocs
      Creating scripts.
      
      # pwd
      /net/web/lappd-trac/LAPPD
      # /bin/rm -r htdocs/
      # mv /tmp/deploy/* .
      

      Now we need to make sure that everything worked.

      # python
      Python 2.6.7 (r267:88850, Jan  5 2012, 08:25:37) 
      [GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import trac.web.main
      >>> (no errors, it's ok)
      
  8. Create a software repo to use
    svnadmin create /net/repos/trac/LAPPD
  9. Need to make sure the python bindings for subversion are installed. Go back to where you originally compiled subversion. Edit the Makefile so that SWIG_PY_INCLUDES includes -I/usr/local/include/Python2.6. Otherwise, the next command will give an error about finding Python.h
    make swig-py
    make install-swig-py
    touch /usr/local/lib/python2.6/site-packages/svn-python.pth
    echo /usr/local/lib/svn-python > /usr/local/lib/python2.6/site-packages/svn-python.pth
  10. Make some admin users
    trac-admin /net/web/lappd-trac/LAPPD permission add user1 TRAC_ADMIN
    trac-admin /net/web/lappd-trac/LAPPD permission add user2 TRAC_ADMIN
  11. Go into the Trac website, login (as one of the admins above) and go to admin and repository. Add the repository created. LAPPD: /net/repos/trac/LAPPD
  12. Resync the repository to Trac
    trac-admin /net/web/lappd-trac/LAPPD repository resync ‘LAPPD’
  13. Macros can be added by downloading the zipped file, unzipping it and running python setup.py install. The macros will only be recognized after restarting httpd.