Install and Configure SVN (Subversion) Server on Ubuntu 16.04 | 18.04 with Apache2

SVN (Subversion) is an open source versioning and revision control system distributed under the open source Apache License and built by Apache Foundation Team. With SVN, one can setup a repository to maintain current and historical versions of files such as source code, documentations and others.

This brief tutorial shows students and new users how to install and configure SVN server on Ubuntu 16.04 | 18.04 with Apache2 HTTP server and allow users to logon and check file in and commit changes.

This post will also show you how to create user accounts to access the subversion repository after creating it.

When you’re ready, continue with the steps below:

Step 1: Install Apache2

Subversion server needs an web or HTTP server. For this setup, we’re going to be using Apache2. On Ubuntu, the commands below will install Apache2.

sudo apt update
sudo apt install apache2 apache2-utils

After installing Apache2, the commands below can be used to stop, start and enable Apache2 service to always start up with the server boots.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

After installing Apache2 continue below to setting up Subversion.

Step 2: Install SVN Packages on Ubuntu

To get Subversion setup and working on Ubuntu, run the commands below to get it including all dependencies:

sudo apt-get install subversion libapache2-mod-svn subversion-tools libsvn-dev

After installing the above packages, run the commands below to enable Apache2 modules that allows Subversion to function.

sudo a2enmod dav
sudo a2enmod dav_svn
sudo service apache2 restart

Step 3: Configure Apache2

Now that Subversion packages are installed, run the commands below to edit SVN config file. This should allow you to create an SVN repository for controlling access. Run the commands below to open the file.

sudo nano /etc/apache2/mods-enabled/dav_svn.conf

Then make the hightlighted changes into the file, then save.

#  . 
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/
# Note, a literal /svn should NOT exist in your document root.
<Location /svn>
  # Uncomment this to enable the repository
  DAV svn

  # Set this to the path to your repository
  #SVNPath /var/lib/svn
  # Alternatively, use SVNParentPath if you have multiple repositories under
  # under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, .).
  # You need either SVNPath and SVNParentPath, but not both.
  SVNParentPath /var/lib/svn

  # Access control is done at 3 levels: (1) Apache authentication, via
  # any of several methods.  A "Basic Auth" section is commented out
  # below.  (2) Apache  and , also commented out
  # below.  (3) mod_authz_svn is a svn-specific authorization module
  # which offers fine-grained read/write access control for paths
  # within a repository.  (The first two layers are coarse-grained; you
  # can only enable/disable access to an entire repository.)  Note that
  # mod_authz_svn is noticeably slower than the other two layers, so if
  # you don't need the fine-grained control, don't configure it.

  # Basic Authentication is repository-wide.  It is not secure unless
  # you are using https.  See the 'htpasswd' command to create and
  # manage the password file - and the documentation for the
  # 'auth_basic' and 'authn_file' modules, which you will need for this
  # (enable them with 'a2enmod').
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd

  # To enable authorization via mod_authz_svn (enable that module separately):
  #AuthzSVNAccessFile /etc/apache2/dav_svn.authz

  # The following three lines allow anonymous read, but make
  # committers authenticate themselves.  It requires the 'authz_user'
  # module (enable it with 'a2enmod').
    Require valid-user

When you’re done, run the commands below to create a SVN Repository in the /var/lib/svn directory.

sudo mkdir /var/lib/svn
sudo svnadmin create /var/lib/svn/repository
sudo chown -R www-data:www-data /var/lib/svn
sudo chmod -R 775 /var/lib/svn

Step 4: Create SVN User Accounts

Now that your SVN repository is created, run the commands below to create an account name admin

sudo htpasswd -cm /etc/apache2/dav_svn.passwd admin

Type a password and continue to complete the setup.

Repeat the step above to create additional users.

Restart Apache2

sudo systemctl restart apache2.service

When you’re done, open your browser and browse to the reposotory, then logon.
SVN ubuntu install

That’s it!. This is how to install and configure Subversion on Ubuntu. now you can learn how to check in file and commit changes.

You may also like the post below:


  1. Hi,
    I am new user to svn. I followed the above steps to create svn repository. It works good.

    I need to create multiple repository for varies users. help me to configure more repository.

Leave a Comment

Your email address will not be published.