Recently I set up a virtual server to use as a development machine. It runs on CentOS 5 and hosts several Subversion repositories with associated Trac projects.
There are many guides and plenty of help on the net to help you setup such a system. However, when I tried to do it I came across a few problems and I hope this post may help at least a few people trying to do the same as me. I am not going to rewrite the great tutorials out there, I will just point you to them and note what things I did differently.
This ‘guide’ should get you from a fresh install of CentOS 5 linux to one or more working Subversion (SVN) repositories and associated Trac wiki’s. Apache/WebDAV is used as the network layer. I have only tested this on a fresh install of CentOS 5.
I am aiming for the following:
- CentOS 5, SVN installed. Apache2 as the network layer using mod_dav_svn.
- Trac running on Apache with mod_python
- SVN repositories located at: /srv/svn (e.g. /srv/svn/my-project), accessible via http://server/svn/my-project
- Trac projects located at: /srv/trac (e.g /srv/trac/my-project) accessible via http://server/trac/my-project
How I did it
Not all the steps are vital (probably) but this is how I got it working. Feel free to skip any non-relevant steps (i.e. there is probably no need for a fresh install). Replace any occurence of with the name of your first project.
1. Fresh install of CentOS. I followed most of the Perfect Setup Guide, except the mail and ISPConfig stuff. The important part is setting up the Apache2 web server.
2. Make sure SVN and mod_dav_svn are installed. As root:
yum install subversion mod_dav_svn
If the following two lines are not present, add them:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
3. Install Trac: Follow Nick’s guide with the alternative Clearsilver installation below. Skip the Apache Configuration part.
Follow all of parts 1 and 2. Instead of part 3 do:
rpm -i clearsilver-0.10.4-1.el5.rf.i386.rpm
rpm -i python-clearsilver-0.10.4-1.el5.rf.i386.rpm
Continue with parts 4.1 and 4.2 of Nick’s guide. Remember, leave out Apache configuration section.
4. Create your first SVN Repository:
svnadmin create --fs-type fsfs /srv/svn/project_name
5. Initialise a Trac project for your new repository:
trac-admin /srv/trac/project_name initenv
For the trac-admin command use the defaults if not sure, giving a descriptive name for the project. The `Path to repository` is: /srv/svn/project_name.
6. Set the correct file permissions for apache
chown -R apache.apache /srv/svn/project_name
chown -R apache.apache /srv/trac/project_name
7. Tell apache where to find the new repository. Here we create an additional Apache configuration file specifically for the SVN repositories.
Add the following directive:
AuthName "My SVN Repository"
8. Add a repository user:
htpasswd -m /srv/svn/.htpasswd username
9. Create the Access Control List for the SVN Repository
Add the following directives:
username = rw
Where username represents the username of the repository user you created earlier.
10. Tell apache where to find the new Trac project. Here we create an additional Apache configuration file specifically for the Trac projects.
Add the following directives:
PythonOption TracEnv /srv/trac/project_name
PythonOption TracUriRoot /trac/
11. Add a Trac user:
htpasswd -m /srv/trac/.htpasswd
12. Give admin permissions to the Trac user you just created:
trac-admin /srv/trac/ permission add TRAC_ADMIN
Where represents the username of the Trac user you just created.
13. Restart Apache:
service httpd restart
You should now have SVN and Trac installed. You will have an SVN repository setup (http://server/svn/) and the Trac wiki (http://server/trac/) associated with the repository.
Please let me know if this helped you. If you come across any problems I will be happy to try and help.
The last part of CentOS HowTos: Subversion will give you a quick introduction on how to use SVN.
Subversion setup guides: here and here
Trac setup guides: here and here.
ClearSilver template system (used by Trac).
Setting up CentOS 5.0