Setting up a Subversion Server

Prerequisites

Install subversion and DAV

# yum install subversion mod_dav_svn

Create the subversion directories

# mkdir /var/svn
# mkdir /var/svn/conf
# mkdir /var/svn/repos

Edit the Apache subversion configuration

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

Paste the following into subversion.conf

<Location /svn> DAV svn SVNParentPath /var/svn/repos AuthzSVNAccessFile /var/svn/conf/authz Require valid-user AuthType Basic AuthName "Authorization Realm" AuthUserFile /var/svn/conf/passwd </Location> <Location /websvn> Require valid-user AuthType Basic AuthName "Authorization Realm" AuthUserFile /var/svn/conf/passwd </Location>

Create the subversion user file

# nano /var/svn/conf/authz

Paste the following into authz

[/] * = your_user = rw

This means that for the / directory, give read/write access to "your_user" and no access to everyone else (*).

More about the authz file.

Create the subversion password file

# htpasswd -c /var/svn/conf/passwd your_user

Download, extract, and setup WebSVN

# cd /var/www/html
# wget http://websvn.tigris.org/files/documents/1380/45610/websvn-2.2.0.tar.gz
# tar -zxf websvn-2.2.0.tar.gz
# mv websvn-2.2.0 websvn
# cd /var/www/html/websvn/include
# cp distconfig.php config.php

Edit the WebSVN configuration file

# nano config.php

Edit the following lines (once nano is open, use it's find feature to locate the lines)

$config->parentPath('/var/svn/repos'); $config->useAuthenticationFile('/var/svn/conf/authz');

Restart Apache

# /etc/init.d/httpd restart

Create your first repository

# svnadmin create /var/svn/repos/test

Complete

You should now be able to browse to http://localhost/websvn to see your subversion repositories, as well as use subversion on the command line.

More Reading

Created by Justin Bennett and Ryan Lewis with help from the COSI Wiki