Subversion server, installing

This article describes setting up a simple Subversion server for your LAN using svnserve. You can choose more advanced configurations if you prefer (see http://svnbook.red-bean.com/ for more information).

1. First let's install Subversion. Use the command:

apt-get install subversion

2. You may like to install these too:

apt-get install subversion-tools db4.4-util patch xml-core

3. Create your repository. I like to use a directory that contains multiple repositories, one for each project; svnserve is quite happy to serve all of them. For example,

mkdir /home/svnrepos svnadmin create /home/svnrepos/project1

4. Create /etc/init.d/svnserve as follows:

# # set -e PATH=/bin:/usr/bin:/sbin:/usr/sbin DAEMON=/usr/bin/svnserve REPOS= /home/svnrepos test -x $DAEMON || exit 0 . /lib/lsb/init-functions case "$1" in    start)         log_daemon_msg "Starting Subversion server" "svnserve"         $DAEMON -d -r $REPOS         log_end_msg $?     ;;     stop) log_daemon_msg "Stopping Subversion server" "svnserve" killproc $DAEMON log_end_msg $? ;;    force-reload|restart)         $0 stop         $0 start     ;;     *) echo "Usage: /etc/init.d/svnserve {start|stop|restart|force-reload}" exit 1 ;; esac exit 0
 * 1) ! /bin/sh -e
 * 2) BEGIN INIT INFO
 * 3) Provides:          synserve
 * 4) Required-Start:    $syslog $time $local_fs $remote_fs
 * 5) Required-Stop:     $syslog $time $local_fs $remote_fs
 * 6) Default-Start:     2 3 4 5
 * 7) Default-Stop:      S 0 1 6
 * 8) Short-Description: Subversion repository server
 * 9) Description:       Debian init script for the Subversion repository server
 * 10) END INIT INFO
 * 1) Author:       Rick Beton

5. Set your server to start at the correct runlevels. I did this by creating symbolic links to /etc/init.d/svnserve: I created /etc/rc1.d/K92svnserve, /etc/rc2.d/S92svnserve, /etc/rc3.d/S92svnserve, /etc/rc4.d/S92svnserve, /etc/rc5.d/S92svnserve.

Alternatively (on Ubuntu, at least), the following will start svnserve at runlevel 2, and stop it on runlevels 0 1 6:

update-rc.d svnserve start 92 2. stop 92 0 1 6.