Translation(s): English - Italiano

Though subversion package provides a lightweight subversion server, svnserve, it does not provide means for running this server as a service. Here we will discuss two ways to run it.

Running svnserve using systemd

Modern Debian uses systemd for service running and management, so it is better to start svnserve server using systemd.

First, create a system user for running the service (root is not really needed and is a bit insecure)

# useradd -r svn

Then create an svn repository root and grant it to svn user

# mkdir -p /srv/svn/repos; chown svn /srv/svn/repos

Create systemd service configuration for svnserve /etc/systemd/system/svnserve.service:

Description=Subversion protocol daemon

ExecStart=/usr/bin/svnserve $DAEMON_ARGS


Then add service startup options at /etc/default/svnserve:

# svnserve options
DAEMON_ARGS="--daemon --pid-file /run/svnserve/ --root /srv/svn/repos --log-file /var/log/svnserve/svnserve.log"

These options will be used by service for starting svnserve.

After that, create a place for log files and grant svn user rights to use it:

# mkdir /var/log/svnserve; chown svn /var/log/svnserve 

And add configure file for logrotate to properly archive this log from time to time. /etc/logrotate.d/svnserve:

/var/log/svnserve/*.log {
    rotate 14
    create 640 svn adm
            if /bin/systemctl status svnserve > /dev/null ; then \
                /bin/systemctl restart svnserve > /dev/null; \

And finally enable service, start it, and check that it works as expected

# systemctl enable svnserve.service

# systemctl start svnserve.service 

# systemctl status svnserve.service
* svnserve.service - Subversion protocol daemon
   Loaded: loaded (/etc/systemd/system/svnserve.service; enabled)
   Active: active (running) since Tue 2019-12-31 21:53:16 MSK; 39s ago
  Process: 798 ExecStart=/usr/bin/svnserve $DAEMON_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 799 (svnserve)
   CGroup: /user.slice/user-1000.slice/session-31211.scope/system.slice/svnserve.service
           `-799 /usr/bin/svnserve --daemon --pid-file /run/svnserve/ --root /srv/svn/repos --log-file /var/log/svnserve/svnserve.log

Dec 31 21:53:16 svn svnserve[798]: DIGEST-MD5 common mech free
Dec 31 21:53:16 svn systemd[1]: Started Subversion protocol daemon.

After this, svnserve service should start automatically on system startup.

This guide is based on this stackoverflow entry

Running svnserve from inetd

For the svn:// protocol, you'll want to add a line to /etc/inetd.conf to start svnserve automatically, something like this:

svn stream tcp nowait my_svn_user /usr/bin/svnserve svnserve -i -r /srv/svn

Where /srv/svn is where your shared repositories live (so users don't have to have /srv/svn included in their URLs), and my_svn_user is a user with permission to read and write the repositories. You'll probably want to create a user specifically for running the svnserve service.

After editing /etc/inetd.conf you run

# update-inetd --enable svn

The idea of -r is twofold:

  1. Makes URLs shorter.
  2. Makes sure remote users can only get into a designated part of your Unix filesystem.

Note: if you are looking for a tutorial about subversion client usage, look at SVNTutorial