Installation

Configuration and installation of a Subversion server.

Initial Preparation

yum -y install autoconf libtool expat-devel libgssapi-devel python-devel

Download the latest version from the Subversion home page (verison 1.4.6 at time of writing).

cd /extra/src
wget http://subversion.tigris.org/downloads/subversion-1.6.11.tar.gz
tar zxvf subversion-1.6.11.tar.gz

Once you have uncompressed the subversion source, proceed to install the prerequisites.

Neon library (http://www.webdav.org/neon/)
The Neon library allows a Subversion client to interact with remote repositories over the Internet via a WebDAV based protocol.

  • CentOS 6 RPM:

    yum install neon-devel
  • Source:
    wget http://www.webdav.org/neon/neon-0.29.3.tar.gz
    tar zxvf neon-0.29.3.tar.gz
    mv neon-0.29.3 subversion-1.6.11/neon

Apache Configuration
Apache can be installed according to these instructions but will need these configuration options, at a minimum:

./configure --enable-dav --enable-so --enable-maintainer-mode

WebDAV instructions are also available for configuring Apache.
Swig
Install Swig:

  • Original instructions:

    cd /extra/src
    wget http://prdownloads.sourceforge.net/swig/swig-1.3.40.tar.gz
    tar zxvf swig-1.3.40.tar.gz
    cd swig-1.3.40
    ./configure
    make && make install
  • CentOS 6:
    yum install swig

SQLite
Subversion requires SQLite, a self-contained, serverless, zero-configuration, transactional SQL database engine, to manage some internal databases:

  • Original instructions:

    cd /extra/src
    wget http://www.sqlite.org/sqlite-amalgamation-3.6.23.1.tar.gz
    tar zxf sqlite-amalgamation-3.6.23.1.tar.gz
    cd sqlite-3.6.23.1

    Configure, build and install:

    ./configure
    make
    make install

    Copy some source files that Subversion will need:

    mkdir /extra/src/subversion-1.6.11/sqlite-amalgamation
    cp sqlite3.c /extra/src/subversion-1.6.11/sqlite-amalgamation/
  • CentOS 6 instructions:
    yum install sqlite-devel

Subversion Installation
With the prerequisites installed in the subversion source tree, configure it:

cd /extra/src/subversion-1.6.11
./configure

Edit /extra/src/subversion-1.6.11/Makefile and append -lgssapi (details) to the end of the line that starts:

SVN_APR_LIBS=...

Then build and install the programs:

make
make install

Confirm that /usr/local/apache2/conf/httpd.conf was modified to contain:

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

Install the Swig Python bindings:

cd /extra/src/subversion-1.6.11
make swig-py
make install-swig-py

Make sure that whatever directory the bindings got installed is in your PYTHONPATH. To do that, check your Python version (python -V) and for CentOS 6 and Python 2.6.x:

echo /usr/local/lib/svn-python > /usr/lib/python2.6/site-packages/subversion.pth

Initial Repository
Create a top-level directory to hold your repositories:

cd /var
mkdir -m 710 svn
chgrp nobody svn

Create your first repository dummy:

cd /var/svn
svnadmin create dummy
chown -R nobody:nobody dummy

Create the Apache user/password file for the svn repositories:

cd /var/svn
/usr/local/apache2/bin/htpasswd -cm .htusers admin
chown root:nobody .htusers
chmod 640 .htusers

To add additional users:

/usr/local/apache2/bin/htpasswd -m .htusers username

Create a text file /var/svn/.authz that defines what the users have access to:

[groups]
admin = admin,username

[/]
@admin = rw
* =

[dummy]
@admin = rw
* = r

Make the file readable by only the Apache user:

chown root:nobody .authz
chmod 640 .authz

Edit /usr/local/apache2.conf/extra/httpd-vhosts.conf and add a VirtualHost directive for your svn server:

<VirtualHost *:80>
  DocumentRoot /var/svn
  ServerName svn.example.com
  ServerAlias svn

  <Location /svn>
    DAV svn
    SVNParentPath /var/svn
    AuthzSVNAccessFile /var/svn/.authz
    Satisfy Any
    Require valid-user

    AuthType Basic
    AuthName "My subversion repository"
    AuthUserFile /var/svn/.htusers
  </Location>
</VirtualHost>

Restart Apache:

svc -t /service/apache
svstat /service/apache

Create additional repos
If you wish to create additional repositories (for different clients, different projects, or however you want to keep things organized) you only need to repeat the following steps. Apache itself should not need to be re-configured; the block above will make it treat ALL directories below the /var/svn directory as subversion repositories.

cd /var/svn
svnadmin create name
chown -R nobody:nobody name

If you are creating a new userid for this repository...

/usr/local/apache2/bin/htpasswd -m .htusers username

To set the access rules for this repository, edit /var/www/.authz.

Recent Updates

  • 2 years 1 week ago
  • 2 years 1 week ago
  • 2 years 1 week ago
    php 8.x
  • 2 years 1 week ago
    10.6.7
  • 2 years 1 week ago
    Drop Centos 5/6 stuff