Cool Solution - Trac installation

From Univention Wiki

Revision as of 14:52, 8 July 2014 by Denissen (talk | contribs) (→‎Further Information: fixed typos)
Jump to: navigation, search
Produktlogo UCS Version 3.2

Note: Cool Solutions are articles documenting additional functionality based on Univention products. Not all of the shown steps in the article are covered by Univention Support. For questions about your support coverage contact your contact person at Univention before you want to implement one of the shown steps.

Also regard the legal notes at Terms of Service.

To manage and document a subversion (SVN) repository, and to easily gather information about errors, the project trac exists. With trac you can manage projects and milestones and assigning tasks to users (similar to bugzilla). This article describes the installation and configuration of trac in an UCS environment.


To install Trac and all required dependencies, the unmaintained repository must be activated and then the needed packages must be installed:

ucr set repository/online/unmaintained="yes"
univention-install libapache2-mod-python libapache2-mod-python-doc python-clearsilver python-subversion subversion trac python-pysqlite2 \
python-genshi libjs-jquery

To enable the Apache webserver to recognize and interpret Python files, the corresponding module must be enabled and the service should be restarted:

a2enmod python
invoke-rc.d apache2 restart


To gain access to a trac hosted project, you first need to create a project and then publish it using either the shipped method by trac or via your Apache webserver.

Create a new project

This is a two-step process. First a SVN repository will be created:

mkdir -p /var/trac/subversion
svnadmin create /var/trac/subversion

Next, the project itself must be created:

mkdir -p /var/trac/projects/<my-project>
trac-admin /var/trac/projects/<my-project> initenv

Publishing a project

Using tracd

To test if the trac project can be accessed, use the tool tracd (provided by trac):

tracd -s --port 8000 /var/trac/projects/<my-project>

You should now be able to access the project by entering the server's IP address and port into your browser:


Using Apache2

Using Apache's PAM module, it is possible to authenticate users against the LDAP. Also, using the Apache webserver gives the possibility to use a virtual host for your project.

To provide access to trac via the Apache webserver, a configuration must be created in this file: /etc/apache2/sites-available/<my-project>.conf, containing the following content:

<Location /<my-project>>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /var/trac/projects/<my-project>
PythonOption TracUriRoot /<my-project>/

The site must be enabled and the webserver should be restarted:

a2ensite <my-project>.conf
invoke-rc.d apache2 restart

PAM authentication

To enable the Apache webserver to authenticate users against the LDAP, a new section must be added to the configuration file /etc/apache2/sites-available/<my-project>.conf:

<Location /<my-project>/login>
Order deny,allow
Allow from all
AuthBasicAuthoritative Off
AuthPAM_Enabled on
AuthPAM_Service httpd-trac
AuthName "trac"
AuthType Basic
require valid-user

A new configuration file /etc/pam.d/httpd-trac must be created for the PAM authentication to fully work with the following content:

#PAM-file for trac
@include common-account
@include common-auth

After creation, the Apache webserver must be restarted:

invoke-rc.d apache2 restart

Further Information

If you're planning to use your Trac installation with the PAM authentication described in this article, please note that this is not possible using the tracd tool provided by Trac.

To use the PAM authentification you have to access it via Apache.

Assuming your /etc/apache2/sites-available/<my-project>.conf looks like the following:

<Location /MyTrac>

Then, you can access your Trac project from
Personal tools