Compulsivo

Installing Trac on CentOS 5

May 16, 2008 · Leave a Comment

I’m using Slicehost, but these instructions should work for any hosting provider running CentOS 5. I am not using Subversion (because it sucks and has been slain by Git). If you need SVN support, check out the posts by Nick or Daniel Skinner.

  1. Install python and mod_python (for Apache)
    1. yum install python mod_python
  2. Install MySQL-python
    1. Download the tarball from http://sourceforge.net/projects/mysql-python
    2. Compile the package:
      python setup.py build && python setup.py install
  3. Install Clearsilver, a templating package needed by Trac
    1. Download Clearsilver from http://www.clearsilver.net/downloads/
    2. Compile Clearsilver:
      ./configure –with-python=/path/to/python && make && make install
    3. Note: My path to python is /usr/lib/python2.4
  4. Install Trac
    1. Download Trac from http://trac.edgewall.org/wiki/TracDownload
    2. Setup Trac:
      python ./setup.py install
  5. Create a Trac project
    1. I’m going to keep all of my Trac projects in /var/www/apps/trac, and for this example, I’ll call my project MyTracProject
    2. trac-admin /var/www/apps/trac/MyTracProject initenv
    3. Give your project a name of your choosing, but accept the default for all other settings.
  6. Install TracWebAdmin
    1. Note: This is an optional step, if you would like to administer Trac from within Trac itself. Also, installation of this plugin is only necessary if you’re running Trac version 0.10 or earlier as 0.11 has integrated this plugin into the core Trac package.
    2. In a temporaty directory, grab the TracWebAdmin package:
      svn co http://svn.edgewall.com/repos/trac/sandbox/webadmin/
    3. cd webadmin
    4. python setup.py egg_info
    5. cp dist/TracWebAdmin-0.1.2dev_r5753-py2.4.egg /var/www/apps/trac/MyTracProject/plugins (Note: the actual filename may be different, depending on the build)
    6. Enable the plugin by adding the following to your trac.ini found at /var/www/apps/trac/MyTracProject/conf/trac.in
      [components]
      webadmin.* = enabled
      
  7. Define some Trac users
    1. Create a file to store your authorized users:
      touch /var/www/apps/trac/auth-file
    2. Add a user to the file:
      htpasswd -m /var/www/apps/trac/auth-file <username>
  8. Give admin permissions to the Trac user
    1. trac-admin /var/www/apps/trac/MyTracProject permission add <username> TRAC_ADMIN
  9. Configure Apache
    1. Load mod_python by editing your httpd.conf (for me this is /etc/httpd/conf/httpd.conf) and add “LoadModule python_module modules/mod_python.so”
    2. I want to access Trac via http://trac.mytrackproject.com
    3. You’ll need a CNAME record in your DNS to support the trac.mytrackproject.com subdomain.
    4. You’ll also need to create a VirtualHost section in Apache’s httpd.conf file. For example:
          <VirtualHost *:80>
      
            ServerName trac.mytrackproject.com
      
            <Location />
              SetHandler mod_python
              PythonHandler trac.web.modpython_frontend
              PythonOption TracEnv /var/www/apps/trac/mytrackproject
              PythonOption TracUriRoot /
            </Location>
            <Location "/login">
              AuthType Basic
              AuthName "trac"
              AuthUserFile /var/www/apps/trac/auth-file
              Require valid-user
            </Location>
      
          </VirtualHost>
      
  10. Restart Apache: service httpd restart
  11. Go to http://trac.mytrackproject.com and start using Trac

Categories: Programming
Tagged: ,

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment