Subversion on Debian 4.0 “Etch”

It sounds like a simple task, and it is. There are three ways of making Subversion repositories available:

  1. HTTP/DAV
  2. svn+ssh
  3. svnserve

On my server I’ve chosen svnserve since (1) HTTP/DAV is just too heavy for my limited purpose and svn+ssh requires me to add UNIX users for every user of my repository. svnserve on the other hand is really simple to setup, and it doesn’t require any additional software such as an Apache web server.

First we need Subversion:

apt-get install subversion

This package includes svnserve, so naturally we’re ecstatically joyous already. Incidentally I like having my Subversion repositories situated in /var/svn/, so let’s create a repository here.

svnadmin create /var/svn/MyRepository

Next up is the configuration. We start by editing svnserve.conf using some text editor capable of editing. Personally I prefer emacs for this task.

emacs /var/svn/MyRepository/conf/svnserve.conf

This is what it could look like.
[general]
anon-access = none
auth-access = write
password-db = passwd
realm = MyRepository

Line three (password-db = passwd) requires follow-up, since it says we’ll be using a password file called passwd.

emacs /var/svn/MyRepository/conf/passwd

My preferred token name is “john” and his password is “secret” apparently.
[users]
john = secret

All that is left to do is starting svnserve.

svnserve -d --listen-host example.com -r /var/svn

This will start svnserve in daemon mode (-d) with /var/svn as its root (-r). Thus MyRepository will be accessible via

svn://example.com/MyRepository

using the username john and the password secret. As it happens any other repository situated in /var/svn/* will also be accessible via the svnserve daemon.

Leave a Reply