Search This Blog

Sunday, December 18, 2011

How To Install Subversion with TRAC on CentOS 5.x

How To Install Subversion with TRAC on CentOS 5.x:

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 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

Red Hat Enterprise Linux / CentOS 5 / x86_64:

rpm -Uhv

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 name here for my Project Repository.

svnadmin create /var/www/svn/svnrepos/

svn mkdir file:///var/www/svn/svnrepos/ file:///var/www/svn/svnrepos/ file:///var/www/svn/svnrepos/ -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/

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 “ Site Repository”

AuthUserFile /var/www/svn/auth/svn.htpasswd

Require valid-user


Start service to take the changes.

/etc/init.d/httpd restart

Now browse your site to see the SVN repository.

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/

Authentication realm: Site Repository

Password for ‘root’ : <enter root password>

Authentication realm: 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 -m “1st Branch for Site”

3) Configure Trac.

First configure trac instance using trac-admin command for svn repository

trac-admin /var/www/trac/ initenv

Creating a new Trac environment at /var/www/trac/

Trac 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

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/

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>





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/

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.

Please use comment for any help.

pixelstats trackingpixel

No comments:

Post a Comment