Install & Configure SVN Server on Ubuntu 20.04 with Apache2

Awais Zafar
4 min readJul 6, 2020

--

I recently moved to a new Software company and I was asked to set up new in-house SVN server, having the latest version of Ubuntu (20.04).

SVN stands for Subversion. It is an open-source centralized version control system written in Java, licensed under Apache. Software developers use Subversion to maintain current and historical versions of files such as source code.

Let’s Setup it with 4 Simple and Quick Steps.

  1. Install Apache2
  2. Install SVN Package
  3. Configure Apache2 with SVN
  4. Create SVN User Accounts.

Step 1: Install Apache2

HTTP Web server is required to install SVN so we will start with installing Apache2. Below Commands will install the Apache on Ubuntu (20.04)

sudo apt update
sudo apt install apache2 apache2-utils

We have installed Apache2 now let’s start and enable it.

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

We have successfully set-up and enable the HTTP web server. Let’s install SVN now.

Step 2: Install SVN

Run the below command and it will automatically install SVN and all dependencies needed for SVN.

sudo apt-get install subversion libapache2-mod-svn subversion-tools libsvn-dev
Complete command to install SVN and its all dependencies

SVN and all dependencies are installed. Now enable Apache2 modules to run SVN to function.

sudo a2enmod dav
sudo a2enmod dav_svn
sudo service apache2 restart

Step 3: Configure Apache2 with SVN

We have successfully installed Apache and SVN now let’s configure them by editing the config file.
Run the below command to Open config file in the command-line editor.

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

Make mentioned Changes/un-comment lines in the file.

This is How svn config file will be looked like after changes for SVN configuration

Exit from file editor by saving the changes. (Ctrl + X with Y for Yes)

Let’s Create Repository Now

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

Step 4: Create SVN User Accounts

Use the below command to create a new SVN user(admin).

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

(it will then ask for root password provide that) and Provide password for admin user)

If you wish to create more users then use the below command

sudo htpasswd -m /etc/apache2/dav_svn.passwd awais

then enter the password and re-enter it.

We have successfully Installed and configure SVN let’s restart the Apache2 server and Test it. Restart Apache2 server with the below command.

sudo systemctl restart apache2.service

Let’s Test It

Open your browser and write the following in your URL bar.

http://{your_ip_address}/svn/project

or

http://{your_ip_address}:80/svn/project

80 is default Port but if you need to change it for some reason then you must need to add this after IP address as I changed to 8090

It will ask for SVN username and password which you created above in Step 4

Open the SVN Repo Url in the Browser
Open the SVN Repo Url in the Browser

You can get you IP address with the following command in Ubuntu

ip a
How to Find IP Address in Ubuntu

Solved Errors:

Error 1:

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

while you start/restart apache2 with command

“sudo systemctl start apache2.service”

or

sudo systemctl restart apache2.service

Faced Error while starting or restarting Apache Server

if you face this error, then in most cases your default port 80 is busy and used by another service.

Solution of Error 1:

Run the Below command to Open ports file and edit that.

sudo nano /etc/apache2/ports.conf

Changed Listen 80 to Listen 8090

Change Port of Apache Server in Ubuntu

Now change the Apache port in the default config file

Change the Apache port in the default config file

Exit from file editor by saving the changes. (Ctrl + X with Y for Yes).

Restart the Apache Server and everything should work fine.

If you face any other issue, do mention and I will put that error with the solution in the error listing so that It could help other readers.

If you find anything that needs to be changed in Article don’t forget to share that. Appreciate your suggestions/corrections.

--

--

Awais Zafar
Awais Zafar

Written by Awais Zafar

I am Expert Laravel, Angular, WordPress and Shopify Developer. I love to learn New Technologies.