Setting up trac on Debian

Trac is an issue tracking system with integrated Wiki that is highly customisable and offers big flexibility. One can use it to handle software projects (but it's not the only application for such type of system).

Having correctly pre-packaged version for your operating system is an advantage – you can setup it more quickly by reusing predefined environment and matching software versions.

OS packages installation

First of all, let's install some basic OS packages on Debian wheezy.

# apt-get install apache2
# apt-get install trac
# apt-get install libapache2-mod-python
# apt-get install trac-wysiwyg
# apt-get install trac-subtickets

We have installed the HTTP server software,  the trac itself (will all dependencies handled by OS packaing system), Apache2 module to run Python scripts server-side, wysiwyg plugin (sometimes it's just easier to edit tables in WYSIWYG mode) and subtickets capability (allows to make hierarchical tickets).

Trac setup

When trac binaries are installed we can create trac workdir and add permissions for admin user:

$ trac-admin /home/www-data/mysite initenv
$ trac-admin /home/www-data/mysite permission add dcieslak TRAC_ADMIN

If some plugins have been installed in workdir:

$ trac-admin /home/www-data/mysite upgrade

Apache setup

In order to be able to authorize in track we have to create auth database with sample user "dcieslak", we will use "digest" method to encrypt passwords exchanged between browser and server (even if no https is used):

$ htdigest -c /home/www-data/mysite/mysite.htpasswd mysite dcieslak

Finally, we will setup Apache config (/etc/apache2/sites-enabled/mysite-trac.conf):

<Location /mysite>
  SetHandler mod_python
  PythonHandler trac.web.modpython_frontend
  PythonInterpreter main
  PythonOption TracEnv /home/www-data/mysite
  PythonOption TracUriRoot /mysite
  SetEnv PYTHON_EGG_CACHE /tmp

  AuthType Digest
  AuthName "mysite"
  AuthUserFile /home/www-data/mysite/mysite.htpasswd
  Require valid-user
</Location>

And make changes effective:

# /etc/init.d/apache2 restart

With above setup you will be able to login to your new Trac installation by calling the following address from your browser:

http://YOUR-SERVER-IP/mysite
This entry was posted in en and tagged , . Bookmark the permalink.