Install Trac on Ubuntu 12.04

Ubuntu 12.04 has packages for Trac, so installation is easy. But you will also need to configure your new Trac enviroment for a new project. Heres a little tutorial on how to setup Trac using Apache.

Install trac package:

sudo apt-get install trac libapache2-mod-python

Configure a new trac project enviroment:

sudo mkdir -p /var/trac/myproject cd /var/trac/myproject sudo trac-admin . initenv sudo htpasswd -c .htpasswd adminusername sudo trac-admin . permission add adminusername TRAC_ADMIN sudo chown -R www-data: . sudo chmod -R 775 .

Configure Apache:

vim /etc/apache2/sites-available/trac-myproject

ServerName trac.local SetHandler modpython PythonInterpreter maininterpreter PythonHandler trac.web.modpythonfrontend PythonOption TracEnv /var/trac/myproject PythonOption TracEnvParentDir /var/trac/myproject PythonOption TracUriRoot / # PythonOption TracEnvIndexTemplate /var/local/trac/templates/index-template.html PythonOption TracLocale enUS.UTF8 PythonOption PYTHONEGGCACHE /tmp Order allow,deny Allow from all AuthType Basic AuthName "myproject" AuthUserFile /var/trac/myproject/.htpasswd Require valid-user

Enable Apache python-mod and the new site. Then restart Apache

sudo a2enmod python sudo a2ensite trac-myproject sudo service apache2 restart

Paul Soucy

Read more posts by this author.