Install & Configure SVN




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

Read More

Installation

You can download Source Or RPM

Dependency

yum install apr auconf libtool serf openssl db4 apache python perl sqlite

Create SVN directory for storage

mkdir /home/svn
cd /home/svn

Create multiple projects with dir structure in single repository.

Here we are creating single repository for multiple projects, this is dir structure. This can be used if projects are inter dependent.

Create single repository

svnadmin create /home/svn/projects

mkdir tmpdir
cd tmpdir
mkdir projectA
mkdir projectA/trunk
mkdir projectA/branches
mkdir projectA/tags
mkdir projectB
mkdir projectB/trunk
mkdir projectB/branches
mkdir projectB/tags

svn import . file:///home//svn/projects –message ‘Initial repository structure’

cd ..
rm -R tmpdir

Create dir structure for multiple repository.

You may require SVN for multiple projects, using separate repository you can define better access rights using Authz file. Below we have used /etc/httpd/svn.authz to delegate rights on user bases.

Create multiple repositories

svnadmin create /home/svn/project1

svnadmin create /home/svn/project2

mkdir tmpdir
cd tmpdir
mkdir trunk
mkdir branches
mkdir tags

svn import . file:///home//svn/project1 –message ‘Initial repository structure’

svn import . file:///home//svn/project2 –message ‘Initial repository structure’

cd ..
rm -R tmpdir

To view svn verbose list

svn list –verbose file:///home/svn/projects

Apache configuration

add followings in /etc/httpd/conf/httpd.conf

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

<Location /svn/repos>
AuthType Basic
AuthName “SVN Authorization Realm”
AuthUserFile /etc/httpd/svn.passwd
Require valid-user
AuthzSVNAccessFile /etc/httpd/svn.authz
DAV svn
SVNParentPath /home/svn/
SVNListParentPath On
SVNIndexXSLT “/svnindex.xsl”
SVNPathAuthz off
</Location>


SVN user based rights

cat /etc/httpd/svn.authz
[project1:/]
* =
dhaval = rw
guest = r

[project2:/]
* =
dhaval = r
guest = r

SVN Users

To create users

htpasswd -c /etc/httpd/svn.passwd  dhaval #for first user
htpasswd  /etc/httpd/svn.passwd  dhaval1 #for 2nd onwards

To delete user

htpasswd -D /etc/httpd/svn.passwd dhaval1

For better output using css

cp /usr/lib/subversion/tools/xslt/* /var/www/html/

If you are facing Access denied to display multiple repositories, you can create simple html & define path for all your repositories.

e.g <a href=”/svn/repos/project1″>Project1</a>

Changes in svn.authz & svn.passwd does not require service httpd reload.


if you find any missing point in here, please let us know in comment section or tweet us at @linuxreaders. To get more articles like this, subscribe to our RSS feeds / Mails.
Read 240 articles by
  • Pingback: Linux Readers » Blog Archive » RespoStyle for SVN

  • Pingback: Linux Readers » Blog Archive » SVN Proxy

Trending Posts