Gentoo Wiki


Merge-arrows.gifIt has been suggested that this article be Merged into one article with Trac.    (Discuss)



This Howto describe how you setup a Trac System based on the Apache2 with mod_python and >= Subversion 1.4 with multiple repositories. I will not describe howto make the installations of it. It only completes some other howtos. For my configuration I use the mod_python for the apache2. (should be 10 times faster than cgi or fastcgi)



If you have already an exists reporistory in /var/svn you have to move it to an another folder.

mv /var/svn/* /var/svn_backup/repos1

emerge --config subversion

Now we should see this.

ls -l /var/svn

svn-trac-server ~ # ls -l /var/svn/
total 0
drwxr-xr-x 2 root root 152 Feb 15 16:25 conf
drwxr-xr-x 7 root root 224 Feb 15 11:37 repos
Note: You don't need the repos directory any more. This is a blank repos from the emerge --config command

Lets create some repositories first and then setup it.

svn-admin create /var/svn/repos1

svn-admin create /var/svn/repos2

svn-admin create /var/svn/repos3

Now we have three repositories created and will now setup all to one authentification and authorization file. For that we have to edit all three "svnserve.conf" files in the "conf" directory of a repository.

vi /var/svn/repos1/conf/svnserve.conf

File: /var/svn/repos1/conf/svnserve.conf
anon-access = none # or read or write
auth-access = write
password-db = /var/svn/conf/passwd
authz-db = /var/svn/conf/authz
realm = Repos1 SVN Repository

So that we do it for all the other repositories, too. Then we will setup the authentification and authorization.

vi /var/svn/conf/passwd

File: /var/svn/conf/passwd
user1 = password1
user2 = password2
user3 = password3
user4 = password4
user5 = password5

Now go into the authz file

vi /var/svn/conf/authz

File: /var/svn/conf/authz
group_repos1_read = user1, user2
group_repos1_write = user3, user4
group_repos2_read = user1, user4

### Global Right for all repositories ###
### Could be a superadmin or something else ###
user5 = rw

### Global Rights for one repository (e.g. repos1) ###
@group_repos1_read = r
@group_repos1_write = rw

### Repository folder specific rights (e.g. the trunk folder) ###
user1 = rw

### And soon for the other repositories ###
@group_repos2_read = r
user3 = rw

So now we can start|restart the svnserve daemon.

/etc/init.d/svnserve restart

Now we should be able to check out and commit to our seperated repostories.

cd /home/workspace/repos1 && svn co <server>/repos1

And soon ;)


The next step is to setup the trac system.

Install "trac" over portage. Then create a trac env with the trac-admin tool.

trac-admin /var/lib/trac/repos1 initenv

Warning: Don't set the /var/svn directory as your repository_dir in the trac.ini. You have to use the exactly repository dir path (e.g. /var/svn/repos1)


And the last step is to configure the apache2 webserver. In this way the DAV support is available too, but is need less because the Trac has its own SVN Source Browser.

Warning: This isn't the complete 00_default_vhost.conf file - only the part that is needed. This will give you a list of Trac projects at

Important changes

File: /etc/apache2/vhost.d/00_default_vhost.conf
        <IfModule mpm_peruser_module>
                ServerEnvironment apache apache

        <LocationMatch "/trac">
                SetEnv PYTHON_EGG_CACHE /tmp
                SetHandler mod_python
                PythonHandler trac.web.modpython_frontend
                PythonOption TracEnvParentDir /var/lib/trac
                PythonOption TracUriRoot /trac/

        <LocationMatch "/trac/[^/]+/login">
                AuthType Basic
                AuthName "Trac Server"
                AuthUserFile /var/svn/conf/svnusers
                Require valid-user

Now we create all needed user for the Apache Authentification

htpasswd2 -c -s -b /var/svn/conf/svnusers user1 password1

Note: The follow command dont need the "-c" argument anymore, because the svnusers exists and should not override every time ;). For more informations read the htpasswd command manual

htpasswd2 -s -b /var/svn/conf/svnusers user2 password2

htpasswd2 -s -b /var/svn/conf/svnusers user3 password3

htpasswd2 -s -b /var/svn/conf/svnusers user4 password4

htpasswd2 -s -b /var/svn/conf/svnusers user5 password5

Final Words

Now you should have run a trac system over the Apache2 and his authentification method "Basic" (not secure ;) ). But other e.g LDAP or something else are possible.


Note: that trac need a trac admin for every trac-enviroment.

trac-admin /var/lib/trac/repos1/ permission add user5 TRAC_ADMIN

trac-admin /var/lib/trac/repos3/ permission add user3 TRAC_ADMIN

Note: mixed database backends (sqlite or postgresql) for the diffrent enviroments are possible.

Note: for sqlite user the apache2 daemon need write permissions on the sqlite db file


You can reach all trac system over the direct url path or you open the root path where trac will show a list with all avalible projects in this root path.






Hemp "j0inty" Cluster <bestmischmaker (at) web (dot) de> Intial this howto here.

Retrieved from ""

Last modified: Tue, 19 Aug 2008 04:33:00 +0000 Hits: 3,288