Configuring the svnserve daemon

– Creating the repositories

If you have not created any subversion repositories yet, you can create one with svnadmin:

# svnadmin create ~/my-repository

– Tweaking svnserve.conf

Open up and edit the svnserve.conf file located in the $HOME/my-repo/conf/ directory.

#
# Sample $HOME/my-repo/conf/svnserve.conf
#
[general]

# Path to the file containing svn users and passwords.
password-db = $HOME/my-repo/conf/passwd

# Authentication realm of the repository. Two repositories using the
# same password-db should have the same realm.
realm = My-test-repository

# Deny all anonymous access
anon-access = none

# Grant authenticated users read and write privileges
auth-access = write

– Setting up password authentication

Open up and edit the password-db file (ie. $HOME/my-repo/conf/passwd). A sample entry might look like this:

[users]
user1 = password1
user2 = password2

– Starting up the server

Run the server by invoking svnserve with the -d switch (daemon mode) and –listen-host 1.2.3.4 (substituting 1.2.3.4 for your v-host IP address).

# svnserve -d –listen-host 1.2.3.4 -r $HOME/my-repo

To ensure that your svnserve gets started whenever the server is booted, you must add a @reboot line to your crontab. Use the crontab -e command to bring up your crontab in your favorite text editor and add the following line:

@reboot svnserve -d –listen-host 1.2.3.4 -r $HOME/my-repo

– Testing the server

To test the server’s functionality, you can create a working copy of your repository using your shell. The checkout command will create a working copy of the repository:

# svn co svn://your-domain.com/$HOME/my-repo my-working-dir
# cd my-working-dir
# echo “foo bar” > test-file
# svn add test-file
# svn remove test-file
# svn commit