Saturday, September 24, 2022

Install and Configure SVN Server on Ubuntu 22.04

In this guide, we want to teach you How to Install and Configure an SVN Server on Ubuntu 22.04.

Apache Subversion (SVN) is free and open-source software developed by the Apache Software Foundation that acts as a control system for tracking changes to files, folders, and directories. It is used to assist in recovering data and recording the history of changes made over time.

It was designed to replace the Concurrent Versions System (CVS), a program designed to save and retrieve multiple source code changes that had many inherent bugs and feature flaws.

How To Install and Configure SVN Server on Ubuntu 22.04

To install SVN on Ubuntu 22.04, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Ubuntu 22.04.

Install Apache Subversion (SVN) on Ubuntu 22.04

First, update your local package index with the following command:

sudo apt update

Then, you need to install Apache to access the SVN server using HTTP URLs. To do this, use the following command:

sudo apt install apache2

Now you can install SVN and also install the Apache module to make SVN work with Apache. Run the following command:

sudo apt install subversion subversion-tools libapache2-mod-svn

After your installation is finished, enable the Apache modules and restart the Apache with the following commands:

$ sudo a2enmod dav
$ sudo a2enmod dav_svn
$ sudo systemctl restart apache2

Configure SVN on Ubuntu 22.04

Here you need to configure Apache with subversion. Open the following configuration file with your favorite text editor, here we use vi:

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

You need to uncomment the following lines at the file by removing the # from the beginning of the lines. These lines should look like this:

<Location /svn>
 DAV svn
 SVNParentPath /var/lib/svn
 AuthType Basic
 AuthName "Subversion Repository"
 AuthUserFile /etc/apache2/dav_svn.passwd
 Require valid-user

When you are finished, save and close the file.

To apply the changes restart Apache with the following command:

sudo systemctl restart apache2

Now you need to create an SVN repository on Ubuntu 22.04. Here we named it myrepo. To do this, you can use the following commands:

$ sudo mkdir -p /var/lib/svn/
$ sudo svnadmin create /var/lib/svn/myrepo

Also, you need to set the correct permissions for the new directories that you have created:

$ sudo chown -R www-data:www-data /var/lib/svn
$ sudo chmod -R 775 /var/lib/svn

Then, you need to create an SVN user in /etc/apache2/dav_svn.passwd file. These users will use it for the authentication of svn repositories.

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

This will create a user named admin and you will be asked to give it a password.

To create additional users you can use the following commands:

$ sudo htpasswd -m /etc/apache2/dav_svn.passwd user1
$ sudo htpasswd -m /etc/apache2/dav_svn.passwd user2

Now you can access the SVN repository on Ubuntu 22.04 by typing your server’s IP address in your web browser followed by /svn/myrepo/:


You should enter your credentials and you will see:

SVN repository

For more information, you can visit the Apache Subversion Documentation page.


At this point, you learn to Install and Configure an SVN server on your Ubuntu 22.04.

Hope you enjoy using it.

Related Articles


Please enter your comment!
Please enter your name here

Latest Articles