If you are running a few projects, there is no doubt that today or tomorrow you shall need a version control system. A version control system keeps track of the different versions of a project. It is now a days a crucial tool in software development. In this post we shall see how we can install subversion on Ubuntu.

To follow this tutorial you shall need:

  • Ubuntu server
  • Root access or sudo privilege
  • A command line text editor (like nano)

Subversion depends on the apache web server. So, before we get started, we are going to install apache first. Type this command on your terminal and press enter:

sudo apt-get install libapache2-svn apache2

Subversion requires secure connection with the client so it needs SSL. We can enable SSL in apache using this command on Ubuntu:

sudo a2enmod ssl

Now open the configuration file for SSL and define the port as 443:

sudo nano /etc/apache2/ports.conf

Once open edit the file like this:

<IfModule mod_ssl.c>
    Listen 443

Now, we have directed apache to run SSL on port 443, we need to generate some SSL certificates. Use the following commands one after one:

sudo apt-get install ssl-cert
sudo mkdir /etc/apache2/ssl
sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem

We’re done dealing with the secure connection. We shall next move to create virtual host for our server. Please use the following commands:

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/svnserver
sudo nano /etc/apache2/sites-available/svnserver

The last command shall open up a text file, Change: “NameVirtualHost *” to “NameVirtualHost *:443” and to . Under the serveradmin section add these lines:

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all

Now let’s enable site and restart apache:

sudo a2ensite svnserver
sudo /etc/init.d/apache2 restart

We have successfully setup a svn server on a Ubuntu machine. On a later post, we shall see how we can create svn repos and manage them.