How to install Apache Subversion on Ubuntu 18.04 LTS

SVN server lets you record changes to a file or set of files over a period of time.

Apache Subversion (known commonly as SVN) is a very popular open source version control system. A version control system lets you record changes to a file or set of files over a period of time so that you can recall specific versions when there is a need.

In order to have version control for your project, you first need to install SVN server on your Ubuntu machine.

Installing SVN Server on Ubuntu 18.04 LTS

Here we are going to install and configure Apache subversion on Ubuntu 18.04 LTS.

Step 1. Install Apache

Before we go ahead with the installation, let us first update repository.

sudo apt-get update
sudo apt-get install apache2

Check apache status.

sudo systemctl status apache2

If service is not yet started, then .start Apache.

sudo systemctl start apache2

Enable Apache on system boot.

sudo systemctl enable apache2

Verify Apache Installation. Just open your web browser and type web server IP or hostname. If you can see the Apache default page, Apache installation is successful.

Step 2. Install Apache Subversion

Install subversion and required packages

 sudo apt-get install subversion libapache2-mod-svn

After installation, it automatically enables the needed SVN modules (dav_module , dav_svn_module, authz_svn_module ).

List the enabled modules

sudo apachectl -M

If svn modules are not enabled. run below commands and enable it

sudo a2enmod dav
sudo a2enmod dav_svn
sudo a2enmod authz_svn

After enabling those modules, we need to restart the Apache service.

sudo service apache2 restart

Step 3. Configure Apache Subversion

Now we are going to create the SVN repository. Here we use “/opt” directory to create our repository.

Create svn directory.

sudo mkdir -p  /opt/svn

Create svn repository. Here we create a repository called “fosslinuxrepo”

sudo svnadmin create /opt/svn/fosslinuxrepo

Changing ownership of the repository.

sudo chown -R www-data:www-data /opt/svn/fosslinuxrepo/

Changing permissions of the repository.

sudo chmod -R 775/ opt/svn/fosslinuxrepo

Add Subversion Users. Here we create a password file in the “/etc” directory.

sudo htpasswd -cm /etc/svn-auth-users  fosslinux

Create the second user.

sudo htpasswd -m /etc/svn-auth-users fosslinux2

Create Apache virtual host file for SVN- in order to do this we first need to change directory to “/etc/apache2/sites-available/”

cd /etc/apache2/sites-available/

Create a virtual host file and here we create a file called “fosslinuxsvn.conf”.

sudo vim fosslinuxsvn.conf

Add following lines to file.

<VirtualHost *:80>
        <Location /svn>
     DAV svn
     SVNParentPath /opt/svn
     AuthType Basic
     AuthName "Subversion Repository"
     AuthUserFile /etc/svn-auth-users
     Require valid-user
    ErrorLog ${APACHE_LOG_DIR}/
    CustomLog ${APACHE_LOG_DIR}/ combined

Change “” to your hostname.

Save and exit the file.

Disable default virtual host file.

sudo a2dissite 000-default.conf

Enable newly created virtual host file.

sudo a2ensite fosslinuxsvn.conf

Check apache syntax.

sudo apachectl -t

Then restart Apache.

sudo systemctl restart apache2

Step 4. Test Configured Apache Subversion

Open the web browser and type repo URL and hit enter.

Replace with your hostname.

When you will get the Authentication popup screen, enter the already created Username and Password to access svn repository.


Now you can see the created repository.


Let us now create a project called “RnD_works ” inside the repository.

svn mkdir file:///opt/svn/fosslinuxrepo/RnD_works -m "added RnD_works repository"
svn mkdir file:///opt/svn/fosslinuxrepo/RnD_works/trunk -m "added RnD_works trunk repository"
svn mkdir file:///opt/svn/fosslinuxrepo/RnD_works/branches -m "added RnD_works branches repository"
svn mkdir file:///opt/svn/fosslinuxrepo/RnD_works/tags -m "added RnD_works tags repository"

Let us check if this new project can be viewed inside the repository.

New Project
New Project

Click and Open “RnD_works”

Inside Project
Inside Project

If you want to delete a created project you can use below command to delete it.

svn delete file:///opt/svn/fosslinuxrepo/RnD_works -m "delete RnD_works repository"

Step 5. Schedule Repository Backup

Create a backup folder.

sudo mkdir -p /etc/backcups

Change user to root user.

sudo su -

Edit crontab.

crontab -e

In the following command, we schedule svn backup midnight every day.

0 0 * * * svnadmin dump /opt/svn/fosslinuxrepo > /etc/backcups/svnbackups-$(date +%Y%m%d).dump


Then save and exit.

Step 6. Restore Repository

If you need to restore svn repository from backup file use below commands.

Create a new repository.

svnadmin create /opt/svn/restorerepo

Restore backup:

svnadmin load /opt/svn/restorerepo < /etc/backups/svnbackups-20190204.dump

That’s all. We hope this article has helped you to configure subversion successfully. If you have any questions or comments, please visit the Comments section below.

Hey! I'm Darshana, a Linux / DevOps Engineer and also a contributor to FOSS Linux. I enjoy working on various kind of Linux distributions and cloud technologies. During my free time, I love to swim and hike across nature trails. Linux is my love and I'm here to share all my learnings with all of you! Hope you enjoyed reading my article.


Please enter your comment!
Please enter your name here




best linux distros programmers
Linux distros have long been a favorite among programmers since the rise in popularity of the OS in the nineties. Programmers are technical by nature, and Linux distros appeal to that technical nature. Let's discuss why Linux is a great desktop OS for programmers and developers, and find out best distros suitable for them.
manjaro complete usb drive
In this tutorial, we will show step by step how to install a Manjaro on a USB flash. For those new to this distro, it is a light-weight distro that is based on Arch Linux. Arch Linux is known for its simplistic approach and is typically made for Linux pros, but Manjaro bridges the gap between user-friendliness and rock-solid performance.
best video players for linux
Most Linux-based systems come with a built-in video player, but let's be honest, it most definitely won't be able to satisfy all of your requirements, due to the fact that default software is mostly made for basic purposes. In this article, we will review the 5 Best Video Players for Linux and thoroughly discuss their features as well as their pros and cons.