Category Archives: Trac

Install Trac

First I installed some packages (not all are required):

apt-get install python-setuptools python-setuptools-git python-genshi python-pygresql subversion subversion-tools git python-babel postfix bsd-mailx

Then I downloaded trac from svn and installed it:

svn co trac_svn
cd trac_svn
python install

Just choose a name for your project and for small projects a local sqlite-db is fine. After this you can go on create a trac environment that can be hosted.

Create new trac project

To get a new project at /var/www/trac the steps would be:

trac-admin /var/www/trac initenv
htpasswd -c /var/www/trac/.htpasswd admin
trac-admin /var/www/trac permission add admin TRAC_ADMIN
chown -R www-data:www-data /var/www/trac
chmod -R 640 /var/www/trac
chmod +X /var/www/trac

This would init a project with an admin user. And here my Apache config for it:

<Location /trac>
    SetHandler mod_python
    PythonInterpreter main_interpreter
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnv /var/www/trac
    PythonOption TracEnvParentDir /var/www/trac
    PythonOption TracUriRoot /trac
    PythonOption TracEnv /var/www/trac
    # PythonOption TracEnvIndexTemplate /var/www/trac/templates/index-template.html
    PythonOption TracLocale en_US.UTF8
    PythonOption PYTHON_EGG_CACHE /tmp
    Order allow,deny
    Allow from all
<Location /trac/login>
    AuthType Basic
    AuthName "myproject"
    AuthUserFile /var/www/trac/.htpasswd
    Require valid-user

This config needs mod-python:

apt-get install libapache2-mod-python
a2enmod python
service apache2 restart