Previously I have installed a DNS service on my Ubuntu server. Today I would like to install a Trac service which supports for multiple projects using Mod_Python on Apache.
Condition :
- I would like to use sub-domain for trac service that is trac.aoddy.com
- Trac service can support multiple projects such as trac.aoddy.com/Project1, trac.aoddy.com/Project2
- Trac service supports SVN service too.
[ad#ad-post-1]
Softwares :
- enscript
- libapache2-mod-python
- python-docutils
- trac
- db4.3-util
- libapache2-svn
- subversion-tools
You can install software by
$ sudo apt-get install enscript libapache2-mod-python python-docutils trac db4.3-util libapache2-svn subversion-tools
Install & Configurations :
- Create SVN directory such as :
$ sudo mkdir /svn
- Set SVN directory to repository.
$ sudo svnadmin create /svn
- Create a user account so as to security policy.
$ sudo htpasswd 2 -cm /etc/apach2/dav_svn.passwd YOUR-ACCOUNT
- Create TRAC directory such as :
$ sudo mkdir /trac
- Change owner of TRAC directory to www-data :
$ sudo chown -R www-data:www-data /trac
- Create a configuration file of TRAC in apache
$ sudo vi /etc/apache2/site-available/trac.aoddy.com
ServerName trac.aoddy.com DocumentRoot /trac SetHandler mod_python PythonInterpreter main_interpreter PythonOption TracEnvParentDir /var/lib/trac PythonOption TracUriRoot / AuthType Basic AuthName "Trac" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user Alias /svn /svnDAV svn SVNParentPath /svn SVNListParentPath On AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd AuthzSVNAccessFile /etc/apache2/authz_svn.access Require valid-user ErrorLog /var/log/apache2/trac.aoddy.com/error.log CustomLog /var/log/apache2/trac.aoddy.com/access.log common - Create a directory for keep error log.
$ sudo mkdir -p /var/log/apache2/trac.aoddy.com/
- Add this site into apache service.
$ sudo a2ensite trac.aoddy.com $ sudo /etc/init.d/apach2 restart
- Sometime you need to re-configure in this file, I recommend you should use these commands.
$ sudo a2dissite trac.aoddy.com $ sudo a2ensite trac.aoddy.com $ sudo /etc/init.d/apach2 restart
- Test by open an URL http://trac.aoddy.com/
Create SVN
You can use this script for create a SVN environment.
#!/bin/bash
PROJECTNAME=$1
mkdir -p /tmp/${PROJECTNAME}/branches /tmp/${PROJECTNAME}/tags/ /tmp/${PROJECTNAME}/trunks
svnadmin create /svn/${PROJECTNAME}
svn import /tmp/${PROJECTNAME} file:///svn/${PROJECTNAME} -m "initial import"
sudo rm -rf /tmp/${PROJECTNAME}
Don’t remember to change mode of this script to execute file and run this script by root permission.
Create TRAC
$ sudo trac-admin /trac/YOUR-PROJECT-NAME initenv
After you run this command you should find some question about your project
the project name (YOUR-PROJECT-NAME)
use the default database connection string (sqlite:db/trac.db)
the path to svn repository (/svn/YOUR-PROJECT-NAME)
use the default Trac templates directory (/usr/share/trac/templates)
Change permission of this project so as to support apache service
$ sudo chown -R www-data /trac/YOUR-PROJECT-NAME
Woowww, you should find your new project on trac service at http://trac.aoddy.com/YOUR-PROJECT-NAME
[ad#ad-post-1]