How To Install Subversion with TRAC on CentOS 5.x

on December 19 | in Hosting / Servers, Linux | by | with 25 Comments

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

related posts

25 Responses to How To Install Subversion with TRAC on CentOS 5.x

  1. Subramanya says:

    if I execute this command: htpasswd -cb /srv/auth/svn.htpasswd svnuser1 passw0rd
    I ll get this o/p : htpasswd: cannot create file /svn/auth/svn.htpasswd..
    web page is also not coming.. its showing error 404

  2. @Subramanya: Sorry for inconvenience, it was my fault as i put wrong location. Please go through again and it will execute perfectly.

  3. Subramanya says:

    Yes U r rt,its executing.. Thanks for ur guidelines

  4. rupali says:

    can i install same on ubuntu?

  5. @rupali: You can use it for ubuntu but for installing packages you should use apt-get rather than rpm or yum

  6. rupali says:

    i m installing subversion & libapache2-svn
    then i type cmd vi /etc/apache2/mods-enabled/dav_svn.conf
    then i done following changes

    DAV svn

    SVNParentPath /home/spry

    AuthType Basic
    AuthName “Subversion Repository”
    AuthUserFile /etc/apache2/dav_svn.passwd
    Require valid-user

    then restart the apache service
    then i type on the browser http://
    it give me error as The requested URL /test was not found on this server.

  7. Abhi Patwardhan says:

    Appreciate the detailed instructions, Sohail. Rock ON!

  8. rupali says:

    i couldn’t get the below file on ubuntu

    vi /etc/httpd/conf.d/trac.conf


  9. In Ubuntu the apache-conf-folder isn’t httpd.
    Look at /etc/apache2

  10. nick says:

    Perfect article about installing Trac, thanks!

  11. dylanklc says:

    In trac 0.12 ,trac-admin no longer asks questions related to repositories. so i connecting with my svn fail. i can’t find the trac.components file to fix repository_dir with my svn.could u help me ?

  12. bdsujan says:


    will you please send me info about centos 5.5 server setup. how can i setup mail server, internet server, file server?

    i already setup trac on centos through your information. thanks.


  13. Rob says:

    You also need to allow access to the repository through the svnserve.conf file

  14. TonyRiver says:

    Is this the same in CentOS, Fedora, and Redhat?

  15. In fact Fedora, CentOS and Redhat are the same.
    But today you should use GIT and not SVN.

  16. mullai says:

    Allready im using SVN for cent os,i create new project.pls help me

  17. Rana khalid says:

    HI, Sohail Riaz,kindly provide me instructions /Steps on linux centos5 and make it with svn checkout wordpress so that i can browse on trac browser,urgent response require ,provide me you contact so that i can contact easily

  18. loadedmind says:

    There is currently no “trac” rpm within the dag repo. Does anyone (or the author of this howto) have a repo that contains trac?

  19. You are years later in this posting. You should use GIT, it’s decades better then SVN

  20. John says:

    I don’t have a choice. I’d still line info on this if possible please.

  21. Javed says:

    Dear Mr. Riaz
    Any idea about installation of SVNManager at Centos 6.5. I need to install it on my Centos machine.

Leave a Reply

Your email address will not be published. Required fields are marked *

« »