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
RPMforge.net 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 http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.5.1-1.el5.rf.i386.rpm

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/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

#
# 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.
   <LimitExcept GET PROPFIND OPTIONS REPORT>
#      # Require SSL connection for password protection.
#      # SSLRequireSSL
#
      AuthType Basic
      AuthName "Subversion Repository"
      AuthUserFile /etc/svn-auth-conf
      Require valid-user
  </LimitExcept>
</Location>

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)

http://localhost/repos/

Should return with the following result:
subversion-result

Sources
http://www.singhvishwajeet.com/2010/04/15/installing-latest-version-of-subversion-on-centosredhat-linux/
http://wiki.centos.org/HowTos/Subversion

Additional Reference Material
http://drup.org/install-subversion-centos-5-apache
http://wiki.centos.org/HowTos/Subversion
http://packages.sw.be/rpmforge-release/
http://www.experts-exchange.com/articles/Software/Development/Management_Debug/Version_Control_CVS/Subversion/Setting-up-SVN-with-HTTP-Access-On-Centos-5.html