Difference between revisions of "Subversion server, installing"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
Line 33: Line 33:
 
   
 
   
 
  PATH=/bin:/usr/bin:/sbin:/usr/sbin
 
  PATH=/bin:/usr/bin:/sbin:/usr/sbin
  DAEMON=/usr/local/bin/svnserve
+
  DAEMON=/usr/bin/svnserve
 
  REPOS=<font color=red>/home/svnrepos</font>
 
  REPOS=<font color=red>/home/svnrepos</font>
 
   
 
   

Revision as of 21:54, 29 January 2007

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:

#! /bin/sh -e
#### BEGIN INIT INFO
# Provides:          synserve
# Required-Start:    $syslog $time $local_fs $remote_fs
# Required-Stop:     $syslog $time $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: Subversion repository server
# Description:       Debian init script for the Subversion repository server
### END INIT INFO
#
# Author:       Rick Beton
#
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

5. Set your server to start at the correct runlevels. I did this using symbolic links, but I think there might be a better way (can anyone else comment?). I created rc1.d/K92svnserve, rc2.d/S92svnserve, rc3.d/S92svnserve, rc4.d/S92svnserve, rc5.d/S92svnserve.