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 <project> 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:
wget http://dag.wieers.com/rpm/packages/clearsilver/clearsilver-0.10.4-1.el5.rf.i386.rpm rpm -i clearsilver-0.10.4-1.el5.rf.i386.rpm wget http://dag.wieers.com/rpm/packages/clearsilver/python-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>
5. Initialise a Trac project for your new repository:
trac-admin /srv/trac/<project> 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>.
6. Set the correct file permissions for apache
chown -R apache.apache /srv/svn/<project> chown -R apache.apache /srv/trac/<project>
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:
<Location /svn/<project>> DAV svn SVNPath /srv/svn/<project> AuthType Basic AuthName "<project> Repository" AuthzSVNAccessFile /srv/svn/svn-acl-conf AuthUserFile /srv/svn/<project>.htpasswd Require valid-user </Location>
8. Add a repository user:
touch /srv/svn/<project>.htpasswd htpasswd -m /srv/svn/<project>.htpasswd <username>
9. Create the Access Control List for the SVN Repository
Add the following directives:
[<project>:/] <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:
<Location /trac/<project>> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnv /srv/trac/<project> PythonOption TracUriRoot /trac/<project> </Location> <Location "/trac/<project>/login"> AuthType Basic AuthName "trac" AuthUserFile /srv/trac/<project>.htpasswd Require valid-user </Location>
11. Add a Trac user:
touch /srv/trac/<project>.htpasswd htpasswd -m /srv/trac/<project>.htpasswd <username>
12. Give admin permissions to the Trac user you just created:
trac-admin /srv/trac/<project> permission add <username> TRAC_ADMIN
Where <username> 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/<project>) and the Trac wiki (http://server/trac/<project>) 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.
ClearSilver template system (used by Trac).