First off, a personal note: I'm still figuring out how to update trac to the latest version. Debian is fkin slow.

Creating the trac environment

For usability, create the trac environment in the site's home folder.

$ trac-admin /var/www/domains/[domain_name]/trac/ initenv

You will be askes several questions. When the svn repository comes up, provide the path where you created your svn repository (ex: /var/www/domains/[domain_name]/svn/ )

After installing the environment, change permissions so both the user and apache can read/write.

$ chown -R web#:www-data /var/www/domains/[domain_name]/trac/
$ chmod -R g+w /var/www/domains/[domain_name]/trac/

Setting up Apache

Configuring the vhost

Add the following to the advanced apache options in the ispconfig pane. If you have configured svn, make sure you dont remove the definitions you added there.

<Location /trac>
   SetHandler mod_python
   PythonInterpreter main_interpreter
   PythonHandler trac.web.modpython_frontend 
   PythonOption TracEnv /var/www/domains/[domain_name]/trac
   PythonOption TracUriRoot /trac
   PythonOption PYTHON_EGG_CACHE /var/www/domains/[domain_name]/tmp/egg-cache
</Location>

After this, save your changes, wait for a little moment and try visiting your newly installed Trac environment at 'http://[domain_name]/trac/'.

Authentication

If you try logging in, you will get a big failure since we still have to configure this. We will use the same 'htdigest' file that we created for our svn repository (for now). If you haven't done this: this is how you create such a file (replace [values]).

$ htdigest -c /var/www/domains/[domain_name]/svn.htdigest [Project] [username]
$ chown web#:www-data /var/www/domains/[domain_name]/svn.htdigest

We need to add some some more to the vhost section (see above):

<Location /trac/login>
AuthType Digest
AuthName "[Project]"
AuthDigestDomain /trac/login
AuthDigestProvider file
AuthUserFile /var/www/domains/[domain_name]/svn.htdigest
Require valid-user
</Location>

 

More Trac Configuration

More Installation

At this point, you haven't done much configuration on your Trac installation. Now is the time to do so. By default, Trac has installed it's own user guide in your wiki system. So go check it out. You can find it quickly on the home page or visit http://[domain_name]/trac/wiki/TracGuide.

Go over the install guide. We are up to the point we have set up our trac-env, webserver with mod_python and basic authentication has been set up. Optionally, you can setup some svn hooks here as suggested in the manual.

Creating a Trac admin

To configure your trac from the admin pages you will need to give a user the permissions to do so. You can use trac-admin for this:

$ trac-admin /var/www/domains/[domain_name]/trac permission add [username] TRAC_ADMIN

Refresh or login after this and you will see the additional "Admin" button in the top menu.

Globally installed Plugins

To enable the use of plugins that have been set up globally on the server, you need to enable inheritance of the globally installed trac.ini file. You do this by opening your trac.ini file (with a text editor). Adjust the [inherit] section so it looks like this:

[inherit]
file = /etc/trac/trac.ini

After changing this, installed plugins will shop up on the admin page.

Note: Plugins still have to be enabled either through the admin interface or by editing the trac.ini configuration page.

Also: As a reference, here is my /etc/trac/trac.ini file:

[inherit]
plugins_dir = /var/trac/plugins/

[spam-filter]
akismet_api_key = SCRAMBLED

As you can see, this also enables the use of a global akismet api key for all trac installations on this server. Users are still able to override this if they want to use their personal key.