Subversion on CentOS 5.4 installation guide

Subversion is an open source version control system. This article will detail an installation of Subversion on a CentOS 5.x / Red Hat Enterprise Linux (RHEL) 5.x workstation. Subversion used for this article is version 1.6.911.

Install rpmforge repository release file. This package contains apt, yum and smart configuration for the RPMforge RPM Repository, as well as the public GPG keys used to sign them.

rpm -Uhv

Install Subversion with Apache Integration

yum install subversion mod_dav_svn

Test the installation (optional)

svn –-version

The result should begin with something like this.

svn, version 1.6.911(r934486)
compiled April 20 2010, 00:33:28

Configure Subversion

gedit /etc/httpd/conf.d/subversion.conf

The configuration file should look something like this.

LoadModule dav_svn_module     modules/
LoadModule authz_svn_module   modules/

# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, "/var/www/svn".  Each repository
# must be readable and writable by the 'apache' user.  
# Note that if SELinux is enabled, the repositories must be labelled
# with a context which httpd can write to; this will happen by default
# for newly created directories in /var/www.  Use the command
# "restorecon -R /var/www/svn" to label the repositories if migrating
# from a system without SELinux enabled; to label a repository outside
# /var/www, use "chcon -R -h -t httpd_sys_content_t /path/to/repos".

# To create a new repository using this scheme, say, 
# http://localhost/repos/stuff, run as root:
#   # cd /var/www/svn
#   # svnadmin create stuff   
#   # chown -R apache.apache stuff

<Location /repos>
   DAV svn
#   SVNParentPath /var/www/svn
SVNPath /var/www/svn/repos
#   # Limit write permission to list of valid users.
#      # Require SSL connection for password protection.
#      # SSLRequireSSL
      AuthType Basic
      AuthName "Subversion Repository"
      AuthUserFile /etc/svn-auth-conf
      Require valid-user

Create accounts
Initially you’ll use the -cm arguments. This creates the file and also encrypts the password with MD5. If you need to add users make sure you simply use the -m flag, and not the -c after the initial creation.

htpasswd -cm /etc/svn-auth-conf yourusername
New password:
Re-type new password:
Adding password for user yourusername
htpasswd -m /etc/svn-auth-conf anotherusername
New password:
Re-type new password:
Adding password for user anotherusername

Setting up Subversion

mkdir /var/www/svn
cd /var/www/svn
svnadmin create /repos
chown -R apache.apache repos
service httpd restart

Test the configuration (optional)


Should return with the following result:


Additional Reference Material