In this howto i will describe how to install subversion with TRAC. Subversion is an open source version control system alternative to CVS and TRAC an enhanced wiki and issue tracking system for software development projects which provides an interface to Subversion. I install it on CentOS 5.4 which is already running as Web Server. I will use sohailriaz.com source to be maintain by Subversion and TRAC to track all development.
1) Installation
To install subversion and trac on CentOS 5.4 we will use dag repositories as it has latest packages (rpms) available for said softwares.
Red Hat Enterprise Linux / CentOS 5 / i386:
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
Red Hat Enterprise Linux / CentOS 5 / x86_64:
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
Now issue yum command to install subversion and trac with pre-requisites.
yum -y install subversion trac mod_dav_svn mod_python
where mod-dav_svn and mod_python are apache modules which will be use later on to access subversion and trac.
2) Configuring Subversion.
2.1) Creating directories for Subversion.
mkdir /var/www/svn/svnrepos
mkdir /var/www/svn/auth
2.2) User Authentication.
We will create a user to access SVN repositories
htpasswd -cb /var/www/svn/auth/svn.htpasswd svnuser1 passw0rd
Adding password for user svnuser1
2.3) Create Project Repository.
Now we will create a Project Repository. It can be user define name. I will choose site-sohailriaz.com name here for my Project Repository.
svnadmin create /var/www/svn/svnrepos/site-sohailriaz.com
svn mkdir file:///var/www/svn/svnrepos/site-sohailriaz.com/branches file:///var/www/svn/svnrepos/site-sohailriaz.com/tags file:///var/www/svn/svnrepos/site-sohailriaz.com/trunk -m “Creating directories for initial import”
Committed revision 1.
Change ownership and group member to apache (default user for web server)
chown -R apache:apache /var/www/svn/svnrepos/site-sohailriaz.com/
Generate configuration for svn to view from website.
vi /etc/httpd/conf.d/svn.conf
<Location /svn>
DAV svn
SVNListParentPath on
SVNParentPath /var/www/svn/svnrepos/AuthType Basic
AuthName “SohailRiaz.com Site Repository”
AuthUserFile /var/www/svn/auth/svn.htpasswd
Require valid-user
</Location>
Start service to take the changes.
/etc/init.d/httpd restart
Now browse your site to see the SVN repository.
http://www.sohailriaz.com/svn/
It will ask the user/pass you created initially and after successful login you will see your repositories.
2.4) SVN Import for site files.
We will use svn import to import files from our site to repository to maintain the code.
svn import /home/sohail/public_html/ http://www.sohailriaz.com/svn/site-sohailriaz.com/trunk/
Authentication realm: SohailRiaz.com Site Repository
Password for ‘root’ : <enter root password>
Authentication realm: SohailRiaz.com Site Repository
Username : svnuser1
Password : passw0rd
Now browse your site and see the trunk folder, you will see your code listed there.
2.5) Branches
If you need to have multiple branches for your site then that is relatively very easy within subversion. All you need to copy from trunk to branches folder with user define name to recognized.
svn copy http://www.sohailriaz.com/svn/site-sohailriaz.com/trunk/ http://www.sohailriaz.com/svn/site-sohailriaz.com/branches/site-sohailriaz.com-branch-1 -m “1st Branch for Site SohailRiaz.com”
3) Configure Trac.
First configure trac instance using trac-admin command for svn repository site-sohailriaz.com
trac-admin /var/www/trac/site-sohailriaz.com initenv
Creating a new Trac environment at /var/www/trac/site-sohailriaz.comTrac will first ask a few questions about your environment
in order to initalize and prepare the project database.Please enter the name of your project.
This name will be used in page titles and descriptions.Project Name [My Project]> Site SohailRiaz.com
Please specify the connection string for the database to use.
By default, a local SQLite database is created in the environment
directory. It is also possible to use an already existing
PostgreSQL database (check the Trac documentation for the exact
connection string syntax).Database connection string [sqlite:db/trac.db]> <Enter>
Please specify the type of version control system,
By default, it will be svn.If you don’t want to use Trac with version control integration,
choose the default here and don’t specify a repository directory.
in the next question.Repository type [svn]> <Enter>
Please specify the absolute path to the version control
repository, or leave it blank to use Trac without a repository.
You can also set the repository location later.Path to repository [/path/to/repos]> /var/www/svn/svnrepos/site-sohailriaz.com
Please enter location of Trac page templates.
Default is the location of the site-wide templates installed with Trac.Templates directory [/usr/share/trac/templates]> <Enter>
…………………..
…………………..
…………………..
Congratulation!
Edit /etc/httpd/conf.d/trac.conf and change /var/trac to /var/www/trac at line starting from PythonOption TracEnvParentDir
vi /etc/httpd/conf.d/trac.conf
following line should be like this
PythonOption TracEnvParentDir /var/www/trac
Create user account for trac access
htpasswd -cb /var/www/trac/.htpasswd tracuser1 passw0rd
Change ownership and group member to apache of trac instances.
chown -R apache:apache /var/www/trac/site-sohailriaz.com
Restart webserver to take changes.
/etc/init.d/httpd restart
Now browse the site and you will see all available projects under trac and then open the project to browse by viewing source.
REFERENCES
http://www.sohailriaz.com/how-to-install-subversion-with-trac-on-centos-5-x/