Subversion (SVN) is a version control system initiated in 2000 by CollabNet Inc. It is used to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly-compatible successor to the widely used Concurrent Versions System (CVS). Subversion is well-known in the open source community and is used on many open source projects.
Subversion was started in 2000 as an effort to write a free version control system which operated much like CVS but with fixed bugs and misfeatures in CVS. By 2001, Subversion was sufficiently developed to be capable of hosting its own source code. More information, including this above paragraphs, is here.
Getting started with SVN
Please refer to my earlier post.
Managing websites with SVN
Please refer to my previous post.
Getting ready for WebSVN
Let us assume that /var/www/mydomain_repos will serve as the DocumentRoot for viewing our subversion repositories/projects via web and that the corresponding URL will be http://repos.mydomain.com/. Let us also assume that this location is already in existence. The Apache configuration file, /etc/httpd/conf/httpd.conf, needs to have the following in it [one can add more stuff]:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # WebSVN - password protected UseCanonicalName Off DocumentRoot /var/www/mydomain_repos ServerName repos.mydomain.com ServerSignature On DirectoryIndex index.html index.php index.cgi index.pl AccessFileName .htaccess # Main Directory <Directory "/var/www/mydomain_repos"> AuthName "Reserved for developers only!" AuthType Basic AuthUserFile /var/www/mydomain_repos/.htpasswd AuthGroupFile /dev/null require valid-user AllowOverride All Order allow,deny Allow from all |
Once these changes are saved, Apache needs to be restarted.
1 | /etc/init.d/httpd restart |
Once that’s done, one can download the latest and greatest stable version from websvn.info and suppose that it’s downloaded to $HOME/Desktop.
1 2 3 4 5 6 7 8 9 10 11 12 13 | cd /tmp mkdir WEBSVN cd WEBSVN tar -zxvpf $HOME/Desktop/websvn-x.y.z.tar.gz cd /var/www/mydomain_repos/ cp -rf /tmp/WEBSVN/websvn-x.y.z/* . # Needed for RSS feed to work properly chmod 777 cache cd include cp distconfig.php config.php |
Customizing WebSVN – /var/www/mydomain_repos/include/config.php
Included below are portions of my copy of config.php that I have edited to make it work for this set up:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | // {{{ PLATFORM CONFIGURATION --- // // Configure these lines if your commands aren't on your path. $config->setSVNCommandPath('/usr/bin'); $config->setDiffPath('/usr/bin'); // For syntax colouring, if option enabled... $config->setEnscriptPath('/usr/bin'); $config->setSedPath('/bin'); // For delivered tarballs, if option enabled... $config->setTarPath('/bin'); // For delivered GZIP'd files and tarballs, if option enabled... $config->setGZipPath('/bin'); // }}} // {{{ REPOSITORY SETUP --- // // Remote repositories (without and with optional group): $config->addRepository('mydomain', 'http://svn.mydomain.com/', NULL, 'svn-userid', 'svn-password'); // }}} |
If the system does not have enscript, it may be installed using the command:
1 2 | # Run as root yum install enscript |
Does it work?
When the browser is pointed to http://repos.mydomain.com/, it prompts for UserID/Password and then displays a following looking screen, it should be working.
Troubleshooting
I followed every step as mentioned. http://repos.mydomain.com/ opens fine and shows only the project name. When I click on it, I don’t see anything else. What’s going on?
I had that problem as well. It took me a while and I thought there was something wrong with the way I had configured Subversion and/or WebSVN. As it turned out, the current [latest, stable] release of WebSVN (2.1.0) requires Subversion 1.2 (or greater), and my instance was 1.1.4. The following command may be used to check the version of Subversion:
1 | svn --version --quiet |
CentOS 4.x didn’t have any further updates available for subversion but Dag Wieers repository had the necessary packages. I downloaded subversion-1.4.6-0.1.el4.rf.i386.rpm, mod_dav_svn-1.4.6-0.1.el4.rf.i386.rpm and installed them using the command:
1 2 | # Run as root rpm -Uvh subversion-1.4.6-0.1.el4.rf.i386.rpm mod_dav_svn-1.4.6-0.1.el4.rf.i386.rpm |
That resolved the issue – WebSVN elegantly displayed the project(s) in the repository and all relevant information.
Cool. Thanks for the how to.
Hi Gowtham
The above documentation was very helpful. However I’m having trouble viewing my SVN repositories through websvn.
While configuring svn on CentOS I have not made any changes to the /etc/httpd/conf/httpd.conf file.
Instead I have configured the /etc/httpd/conf/subversion.conf file. I added the below lines to the file
DAV svn
SVNPath /var/www/svn/repos
AuthType Basic
AuthName “Subversion repos”
AuthUserfile /etc/.svn-auth-conf
Require valid-user
I have created a directory /var/www/svn and in this directory I have created the repository called repos.
Now I’m able to acces the repository by through the web browser by typing http://ipaddress/repos
Now I want to install websvn and access the same repositories through websvn.
Please suggest how I can achieve this