Thursday, 6 February 2014

Setup SVN (Subversion) on Fedora / RHEL

Apache Subversion (often abbreviated SVN) is a software versioning and revision control system distributed as free software under the Apache License. Developers use Subversion 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).

This instructions will help you installing SVN server.

Install PHP and Apache Packages

yum install httpd php php-devel php-cli php-pear


Start Apache web server and setup for it to autostart on system boot
yum install httpd php php-devel php-cli php-pear
service httpd restart
chkconfig httpd on


Install svn using yum
yum install mod_dav_svn subversion


Configure Subversion (subversion.conf)
vi /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

<Location /svn>
DAV svn
SVNParentPath /svn/repos/projectX
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/svn-auth-file
Require valid-user
</Location>

Create SVN Repository

cd /svn/repos/projectX
svnadmin create svnrepo
chown -R apache:apache svnrepo


Create SVN Users
Following commands will create two users for svn.
htpasswd -cb /etc/svn-auth-file admin9 pass9
htpasswd -b /etc/svn-auth-file user8 pass8

If you are wondering why I display the password on commandline. I actually hit a bug. My httpd version is 2.4.4. See this Link1 Link2

If you have httpd 2.4.6 and above you can use below command.

htpasswd /etc/svn-auth-file user7

Access Your Repository in Browser

Open using a browser to access the repository.
http://192.168.0.5/svn/svnrepo/

Enter user name and password in browser.

Checkout Files to Your Repository
svn co http://192.168.0.5/svn/svnrepo/

Add and Checkin Files to Your Repository
cd svnrepo
vi fileA.txt 
vi fileB.txt
svn add fileA.txt fileB.txt
svn ci fileA.txt fileB.txt -m "First commit"

Access http://192.168.0.5/svn/svnrepo/ url in browser, you will see your new files there.

No comments :

Post a Comment

search iomeweekly