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.
https://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/ https://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 https://www.sohailriaz.com/svn/site-sohailriaz.com/trunk/ https://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.
Please use comment for any help.
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
@Subramanya: Sorry for inconvenience, it was my fault as i put wrong location. Please go through again and it will execute perfectly.
————
Regards,
Yes U r rt,its executing.. Thanks for ur guidelines
Hi,
can i install same on ubuntu?
thanx
@rupali: You can use it for ubuntu but for installing packages you should use apt-get rather than rpm or yum
———-
Regards,
hi
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.
Appreciate the detailed instructions, Sohail. Rock ON!
i couldn’t get the below file on ubuntu
vi /etc/httpd/conf.d/trac.conf
thanx
In Ubuntu the apache-conf-folder isn’t httpd.
Look at /etc/apache2
Perfect article about installing Trac, thanks!
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 ?
hi!
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.
bdsujan
You also need to allow access to the repository through the svnserve.conf file
http://www.duchnik.com/tutorials/vc/installing-and-configuring-svn-on-centos
Is this the same in CentOS, Fedora, and Redhat?
In fact Fedora, CentOS and Redhat are the same.
But today you should use GIT and not SVN.
hi
Allready im using SVN for cent os,i create new project.pls help me
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
There is currently no “trac” rpm within the dag repo. Does anyone (or the author of this howto) have a repo that contains trac?
You are years later in this posting. You should use GIT, it’s decades better then SVN
I don’t have a choice. I’d still line info on this if possible please.
Dear Mr. Riaz
Any idea about installation of SVNManager at Centos 6.5. I need to install it on my Centos machine.