UnixServerAdmin

Server Administration & Management

How to Install & Configure SVN Server

SVN (Subversion) :- Subversion is a free/open-source version control system. Subversion manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data, or examine the history of how your data changed. In this regard, many people think of a version control system as a sort of “time machine”.

1. Install needed packages (mod_dav_svn and subversion)

# yum install mod_dav_svn subversion

2. Modify Subversion config file /etc/httpd/conf.d/subversion.conf

# /etc/httpd/conf.d/subversion.conf

Add following config to /etc/httpd/conf.d/subversion.conf file:
=======================================================
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   AuthType Basic
   AuthName “Subversion Repositories”
   AuthUserFile /etc/svn-auth-users
   Require valid-user
</Location>
=======================================================

Add AuthzSVNAccessFile row to subversion server config

AuthzSVNAccessFile /etc/svn-access-control

Finally /etc/httpd/conf.d/subversion.conf file should look something like following:

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

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   AuthType Basic
   AuthName “Subversion repositories”
   AuthUserFile /etc/svn-auth-users
   AuthzSVNAccessFile /etc/svn-access-control
   Require valid-user
</Location>
=======================================================

3. Add SVN (Subversion) users, Use following command:

# htpasswd -cm /etc/svn-auth-users testuser1 [Create testuser1, also create new file]

# htpasswd -m /etc/svn-auth-users testuser2 [Create testuser2]

Note: Use exactly same file and path name as used on subversion.conf file. This example use /etc/svn-auth-users file.

4. Create SVN Access Control file as /etc/svn-access-control file

# touch /etc/svn-access-control

5. Open /etc/svn-access-control file with your favourite editor ##

#  vi /etc/svn-access-control

Add following type content to file:

=======================================================
[groups]
testgroup1 = testuser1, testuser2
testgroup2 = testuser3, testuser4, testuser5
testgroup3 = testuser6, testuser7

[/]
* = r
@testgroup1 = rw
testuser4 = rw

[testrepo:/]
@testgroup2 = rw
testuser6 = rw

[testrepo2:/unixserv
@testgroup3 = rw
testuser5 = rw

[testrepo2:/tags]
@testgroup3 = r
testuser5 = rw
=======================================================

6. Create and configure SVN repository

# mkdir /var/www/svn

# cd /var/www/svn

# svnadmin create testrepo

# chown -R apache.apache testrepo

# chcon -R -t httpd_sys_content_t /var/www/svn/testrepo [If SELinux is enable]

# chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo [Following enables commits over http]

5. Configure repository

To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf file:

anon-access = none [Disable anonymous access]

authz-db = authz [Enable access control]

8. Restart Apache Web Server

# /etc/init.d/httpd restart “OR”

# service httpd restart

Advertisements

September 13, 2011 - Posted by | SVN | , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: