Installing Trac and Subversion on CentOS5
Installing Trac and Subversion on CentOS is pretty simple.
First, you need to install subversion - it was automatically installed for me already when I installed the OS, however I wanted to update it and found out that I couldn't do so until I deleted the i386 version.
Don't do this step if you're on a 32-bit system!
yum erase subversion.i386
Next, you can install or upgrade subversion and add mod_dav_svn
yum install subversion mod_dav_svn
And Trac...
yum install python cd /tmp wget http://peak.telecommunity.com/dist/ez_setup.py python ez_setup.py yum install mod_python
MySQL-python is needed for python to interact with mysql. Download the latest MySQL-python from http://sourceforge.net/projects/mysql-python, then:
tar -zxvf mysql-python-tarball.tar.gz cd mysql-python-source-directory python setup.py build && python.setup.py install
Some developer packages will also be needed:
yum install neon neon-devel python-devel swig
Next, install clearsilver. You should look for the version that works for your OS. For CentOS 5, it's the latest el5.rf, and either i386 or x86 depending on your setup. You can find the list of packages here: http://dag.wieers.com/rpm/packages/clearsilver/. Make sure that you get the same version number of clearsilver and python-clearsilver.
wget http://dag.wieers.com/rpm/packages/clearsilver/clearsilver-VERSION.el5.rf.ENVIRONMENT.rpm rpm -i clearsilver-VERSION.el5.rf.ENVIRONMENT.rpm wget http://dag.wieers.com/rpm/packages/clearsilver/python-clearsilver-VERSION.el5.rf.ENVIRONMENT.rpm rpm -i python-clearsilver-VERSION.el5.rf.ENVIRONMENT.rpm
Now that you have all of these, you can install Trac. Download the latest tar from http://trac.edgewall.org/wiki/TracDownload
cd /tmp wget http://path.to/TracDownloadTarball.tar.gz tar -zxvf TracDownloadTarball.tar.gz cd TracDownloadTarball python ./setup.py install
You're done.
Create SVN Repositories and link new Trac projects to them. You'll first make directories to place your svn and trac projects (i'm using /var/www/svn|trac)
mkdir /var/www/svn/svn-repository-name mkdir /var/www/trac/svn-repository-name svnadmin create --fs-type fsfs /var/www/svn/svn-repository-name trac-admin /var/www/trac/ initenv chown -R apache.apache /var/www/svn/svn-repository-name chown -R apache.apache /var/www/trac/svn-repository-name
Now you'll need to make a subversion.conf file for apache to load up. One might already exist (it did in my case), but even if it doesn't, that's ok.
vim /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <VirtualHost *:80> ServerName svn.astrosmurf.com DocumentRoot /path/to/existing/empty/directory <Location /> DAV svn SVNParentPath /path/to/svn/root SVNListParentPath on Order allow,deny Allow from all </Location> <LocationMatch /.+> # access differences per repository in here: AuthzSVNAccessFile /path/to/svn/root/svn-acl-conf # means to authenticate the user AuthType Basic AuthName "Astrosmurf Subversion" AuthUserFile /path/to/svn/root/svn.htpasswd # only authenticated users may access the repository Require valid-user </LocationMatch> ErrorLog /var/www/logs/error.svn.log CustomLog /var/www/logs/access.svn.log combined </VirtualHost>
You'll also want to do the same for Trac
vim /etc/httpd/conf.d/trac.conf
and the contents should look similar to this (of course, modify both of these to suit your needs):
<IfModule mod_python.c> <VirtualHost *:80> ServerName trac.yourserver.com DocumentRoot /path/to/existing/empty/directory <Location /> SetHandler mod_python PythonInterpreter main_interpreter PythonHandler trac.web.modpython_frontend PythonOption TracEnvParentDir /path/to/trac/root PythonOption TracUriRoot / PythonOption PYTHON_EGG_CACHE /usr/lib/trac/plugins-cache Order allow,deny Allow from all </Location> <LocationMatch /[^/P]+/.*> # means to authenticate the user AuthType Basic AuthName "Subversion" AuthUserFile /path/to/svn/root/svn.htpasswd AuthGroupFile /path/to/svn/root/svn-authgroup-conf # only authenticated users may access the repository Require group staff </LocationMatch> <LocationMatch /Pub[^/]+/.*> # means to authenticate the user AuthType Basic AuthName "Subversion" AuthUserFile /path/to/svn/root/svn.htpasswd # only authenticated users may access the repository Require valid-user </LocationMatch> ErrorLog /var/www/logs/error.trac.log CustomLog /var/www/logs/access.trac.log combined </VirtualHost> </IfModule>
Now, make the different auth files. This file contains users and groups... in fact I don't remember why i have both the acl and the authgroup file, but whatever...
vim /var/www/svn/svn-acl-conf
[groups] staff = user1, user2, user3 rb = reviewboard [/] @rb = rw [name_of_staff_repo:/] @staff = rw [name_of_user1_repo:/] user1 = rw [Public:/] @staff = rw public = r
and set up authgroup. This file contains group names and who belongs to them
vim /var/www/svn/svn-authgroup-conf
staff: user1 user2 user3
And the passwords file
touch /var/www/svn/svn.htpasswd htpasswd -m /var/www/svn/svn.htpasswd user1 htpasswd -m /var/www/svn/svn.htpasswd user2 htpasswd -m /var/www/svn/svn.htpasswd user3
You can also create a public user and somehow let the public know that they can enter your repository with username public and password public.
htpasswd -m /var/www/svn/svn.htpasswd public
Restart httpd and you should should now be able to go to http://svn.yourhost.com/ and http://trac.yourhost.com/
service httpd restart
A lot of this info came from several different sources, some from googling and others form these places: