Trac is an easy-to-use wiki and issue tracking system aimed at software development projects. It provides a convenient interface to Subversion. trac is already installed and is supported on our servers. The installation procedure is simple.

Initializing the environment

Use the trac-admin tool to initialize a new trac environment. It can be located anywhere under your ~/www/ tree. You will typically have one trac environment per project.

  $ trac-admin $HOME/www/myproject initenv

trac-admin will ask for:

  • Project Name: (enter any name)
  • Database connection string: (accept default)
  • Path to repository: /home/yourname/path/to/svn-repository
  • Templates directory: (accept default)
Configuring administrator access

Now enter trac-admin's interactive mode, and use the permission add command to configure an administrator:

  $ trac-admin $HOME/www/myproject
  # permission add admins TRAC_ADMIN
  # permission add yourname admins
  # exit

You can use any of the available Apache authentication methods to limit access to your trac. To use basic password authentication, create a password file:

  $ htpasswd -c ~/.htpasswd-myproject yourname
  New password: (password)
  Re-type new password: (password)
Making trac web-accessible

In the ~/www/myproject/ directory, create an .htaccess file specifying your authentication policy. It is possible to limit access based on passwords, client IP addresses, etc. See the htaccess howto and Apache documentation for more details. For basic password authentication, one would use:

  AuthType Basic
  AuthName "Trac"
  AuthUserFile /home/yourname/.htpasswd-myproject
  Require valid-user
  DirectoryIndex index.cgi

The Trac FastCGI script (installed in /var/www/trac/cgi-bin), should be invoked with the TRAC_ENV environment variable set as the path name to the Trac environment. Create a new file named index.fcgi in your ~/www/myproject/, containing:

export TRAC_ENV
exec /var/www/trac/cgi-bin/trac.fcgi

Finally, give the script execute permissions and trac should become accessible from the web.

  $ chmod 700 ~/www/myproject/index.fcgi

Note that the FastCGI mode of Trac can require heavy server resources, which may not be available based on your current hosting package. You can always monitor your process usage with top(1) and see from your error logs whether your trac instances are running into resource limits.

If there are problems related to the FastCGI method, you can also execute Trac as traditional CGI by substituting trac.fcgi for trac.cgi, and renaming your index file with the .cgi suffix.