Update There is a better walk-through for installing subversion with apache here .

Install Berkeley DB :

$ wget http://downloads.sleepycat.com/db-4.4.20.tar.gz
$ tar xvzf db-4.4.20.tar.gz
$ cd db-4.4.20/build_unix/
$ ../dist/configure
$ make
$ sudo make install
$ /sbin/ldconfig

Install Swig :

$ wget http://jaist.dl.sourceforge.net/sourceforge/swig/swig-1.3.28.tar.gz
$ tar xvzf swig-1.3.28.tar.gz
$ cd swig-1.3.28
$ ./configure --with-python=/usr/local/bin/python
$ make
$ sudo make install
$ /sbin/ldconfig

Install Subversion :

$ wget http://subversion.tigris.org/downloads/subversion-1.2.3.tar.gz
$ tar xvzf subversion-1.2.3.tar.gz
$ cd subversion-1.2.3
$ ./configure \
     --disable-mod-activation \
     --enable-swig-bindings=python \
     --with-zlib \
     --with-swig=/usr/local \
     --with-berkeley-db=/usr/local/BerkeleyDB.4.4
$ make
$ sudo make install

Next, we need to make the subversion/python bindings. There is a bug we need to correct in one of the header files. In ./apr/include/apr.h at around line 388, paste the following (before the APR_PATH_MAX definition).

#if !defined(PATH_MAX)
#define PATH_MAX 4096
#endif

Now we can compile the bindings:

$ make swig-py
$ sudo make install-swig-py
$ cd /usr/local/lib/python2.4/site-packages
$ sudo ln -s /usr/local/lib/svn-python svn-python
$ sudo ln -s /usr/local/lib/svn-python/svn svn
$ sudo ln -s /usr/local/lib/svn-python/libsvn libsvn
$ /sbin/ldconfig

Add Umasks :

$ sudo cp /usr/local/bin/svn /usr/local/bin/svn.orig
$ sudo vi /usr/local/bin/svn

Add the following to /usr/local/bin/svn:

#!/bin/sh
umask 002
/usr/local/bin/svn.orig "$@"
$ sudo cp /usr/local/bin/svnserve /usr/local/bin/svnserve.orig
$ sudo vi /usr/local/bin/svnserve

Add the following to /usr/local/bin/svnserve:

#!/bin/sh
umask 002<
/usr/local/bin/svnserve.orig "$@"

Create The Repository And Add Users :

$ sudo /usr/sbin/groupadd -g 56 svn
$ sudo /usr/sbin/useradd -d /home/svn/ -ppassword -g svn -u 56 svn
$ sudo install -d -m0755 -o svn -g svn /home/svn/repositories
$ sudo svnadmin create --fs-type fsfs /home/svn/repositories/your_repository_name
$ sudo chown -R svn:svn /home/svn/repositories/your_repository_name
$ sudo chmod -R g+w /home/svn/repositories/your_repository_name
$ sudo chmod g+s /home/svn/repositories/your_repository_name/db
$ sudo /usr/sbin/usermod -G svn your_user_name
$ sudo /usr/sbin/usermod -G svn your_user_name

Set Up Remote Access :

  • On the remote server (the one you want to access svn from) run the following as user ‘your_user_name’ (just hit enter when prompted for a passphrase). bash$ ssh-keygen -t rsa -b 2048
  • On the remote server, copy the contents of the ~/.ssh/id_rsa.pub file which should start with “ssh-rsa” and end with “your_user_name@hostname”.
  • On the subversion server, create ‘.ssh/authorized_keys’ in the ‘your_user_name’ user’s home directory.
  • add the following to .ssh/authorized_keys (making sure there are no linebreaks): bashcommand="/usr/local/bin/svnserve --tunnel-user svn -t -r /home/svn/repositories",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty _contents_of_remote_.ssh/id_rsa.pub_file
  • Now you should be able to use subversion from the remote server using: bash$ svn co svn+ssh://server.domain.name/repository_name ./local_directory

Setup svnserve for local access :

  • Put the configuration file svnserve.conf into ‘/home/svn/repositories/your_repository_name/conf/’ and ‘/home/svn/repositories/proxy_server/conf/’
  • Put the configuration file passwd into ‘/home/svn/repositories/your_repository_name/conf/’ and ‘/home/svn/repositories/proxy_server/conf/’
  • Start the subversion server: bash$ svnserve -d -r /home/svn/repositories/
  • You should now be able to access subversion locally (you will be prompted for a password) using: bash$ svn co svn://localhost/analytics_server ./analytics_server