SVN server en repository aanmaken op Debian

Als u gebruik maakt van een VPS met Debian, kunt u gemakkelijk een SVN server installeren en vervolgens een SVN repository aanmaken.

Installeer een SVN server op Debian

In Debian kunt u gemakkelijk een SVN server installeren met behulp van de Aptitude package manager. Om te zorgen dat u de nieuwste versie van SVN krijgt, kunt u het beste eerst Aptitude bijwerken:

# apt-get update

Vervolgens kunt u de SVN server installeren:

# apt-get install subversion

Maak nu een directory aan waarin u uw SVN repositories gaat bewaren.

# mkdir /var/lib/svn

De SVN server moet nu nog gestart worden. Op Debian is hier géén script voor in /etc/init.d/ aanwezig. U kunt hiervoor onderstaand script gebruiken. Let op dat u in de 18e regel, die begint met "OPTIONS=", verwijst naar de SVN-directory die u in de vorige stap heeft aangemaakt indien deze afwijkt van /var/lib/svn.

# editor /etc/init.d/svnserve
#! /bin/sh
### BEGIN INIT INFO
# Provides:          svnserve
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      $time ypbind sendmail
# Should-Stop:       $time ypbind sendmail
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/svnserve
NAME=svnserve
DESC="SVN Repository Server Daemon"
test -x $DAEMON || exit 0
OPTIONS="-d -r /var/lib/svn"
# Get lsb functions
. /lib/lsb/init-functions
. /etc/default/rcS
start() {
       echo "Starting $DESC... "
       #       echo "Starting $DESC: "
       if ! start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- $OPTIONS
>/dev/null 2>&1; then
               status=$?
               echo $status
               return $status
       fi
       log_end_msg 0
       return 0
}
case "$1" in
 start)
       start
       ;;
 stop)
       echo "Stopping $DESC: "
       start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
       echo $?
       ;;
 restart|force-reload)
       $0 stop
       sleep 1
       start
       #echo "$NAME."
       ;;
 *)
       N=/etc/init.d/$NAME
       echo "Usage: $N {start|stop|restart|force-reload}" >&2
       exit 1
       ;;
esac
exit 0

Vervolgens dient het init-script de juiste chmod privileges te hebben. Tevens moeten we zorgen dat het script automatisch wordt aangeroepen bij het opnieuw opstarten van de VPS:

# chmod +x /etc/init.d/svnserve
# update-rc.d svnserve defaults

Nu kunt u de SVN server starten:

# /etc/init.d/svnserve start

Maak een SVN repository aan

Nu de SVN server online is, is het eenvoudig om een SVN repository (repo) in de SVN-directory aan te maken:

# svnadmin create /var/lib/svn/repo

Vervolgens maken we voor deze repo een gebruikersnaam en wachtwoord aan:

# editor /var/lib/svn/repo/conf/passwd
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
gebruikersnaam = wachtwoord

Voordat de gebruikersnaam en het wachtwoord werken moeten svnserve.conf op de juiste manier ingesteld worden. Regel 32, die begint met "realm =", dient aangevuld te worden door de gewenste naam van de repository.

# editor /var/lib/svn/repo/conf/svnserve.conf
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

### Visit http://subversion.tigris.org/ for more information.

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
anon-access = none
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
# authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
realm = Mijn Eerste Repository

[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256

U bent nu klaar om SVN te gaan gebruiken met behulp van bijvoorbeeld een (Windows) SVN client zoals Tortoise.

SVN beveiligen

Zoals met elke service raden wij u aan SVN via een beveiligde verbinding te gebruiken. U kunt SVN bijvoorbeeld voorzien van SSL. Omdat SVN in de meeste gevallen niet publiekelijk gebruikt wordt, raden wij u echter aan om SVN te installeren op een aparte VPS waarmee u vervolgens via OpenVPN verbinding mee maakt. U hoeft dan SVN niet meer extra te beveiligen.

Mijn Rimote

Bent u al klant van Rimote? U kunt dan inloggen in Mijn Rimote. Hier kunt u o.a. alle informatie over uw abonnementen bekijken, facturen inzien en betalingen doen. Tevens kunt u heel makkelijk via Mijn Rimote ons een vraag stellen.

Wie is Rimote

Rimote is een full-service internetbureau uit Groningen met een groot team aan internet professionals, opgericht in 2005. Zoekt u een ervaren ICT-partij om uw idee voor een website of webapplicatie uit te voeren? U kunt altijd een vrijblijvend gesprek aanvragen om de mogelijkheden te bespreken. De koffie staat klaar!

Uw domeinnaam nog vrij?

Volg ons ook op social media

Meer weten of eens langs komen?

Bel of mail voor een afspraak

Bezoekadres

Rimote
Herestraat 106
9711 LM Groningen

Telefoon

050 - 763 04 07
(ma-vr 9:00 tot 18:00)

06 - 43 887 949
(24/7 storingsnummer)

Postadres

Rimote
Pioenstraat 194
9713 XX Groningen