Subversion is an product of Apache Software Foundation. It is open-source revision control system, which is designed to be a replacement for CVS. This article will help you install and configure SVN Server on Ubuntu & LinuxMint operating system.

1. Install Required Packages

First install required packages for Subversion server on your system.

$ sudo apt-get update
$ sudo apt-get install subversion subversion-tools libapache2-svn

2. Configure Apache Module

Now enable Dav svn module in Apache2 server using following command.

$ sudo a2enmod dav_svn

Now create main svn directory on your svn server.

$ sudo mkdir /var/svn

Lets edit Apache dav_svn module configuration file and add following settings at end of file.

$ sudo vim /etc/apache2/mods-available/dav_svn.conf
<Location /svn>
  DAV svn
  SVNParentPath /var/svn

After making above changes, restart Apache service.

$ sudo service apache2 restart

3. Create Your First Repository

Create your first svn repository named firstrepo, You can use any suitable name.

$ cd /var/svn
$ sudo svnadmin create firstrepo

Now create a directory and create skeleton directories for your first repository.

$ mkdir ~/mainrepo
$ cd ~/mainrepo
$ mkdir trunk tags branches

Import skeleton directory to your first repository.

$ sudo svn import ~/mainrepo file:///var/svn/firstrepo -m 'Adding Initial Directories'

Adding         /root/mainrepo/tags
Adding         /root/mainrepo/trunk
Adding         /root/mainrepo/branches

Committed revision 1.

4. Setup Apache for First Repository

Now edit dav_svn apache module configuration file and add your first repository settings.

$ sudo vim /etc/apache2/mods-available/dav_svn.conf
<Location /svn/firstrepo >
  AuthType Basic
  AuthName "Authorized Access Only"
  AuthUserFile /etc/apache2/dav_svn.passwd
  Require valid-user admin

Now add user in password file for authentication of svn repositories.

$ sudo htpasswd /etc/apache2/dav_svn.passwd admin

Let’s restart Apache service again.

$ sudo service apache2 restart

Subversion First Repo

5. Checkout Repository

At this point you have successfully created svn repository for your first project. Let’s checkout your project to your working directory.

$ svn co ~/firstrepo 

Authentication realm:  Authorized Access Only
Password for 'root': [Just Press Enter]
Authentication realm:  Authorized Access Only
Username: admin
Password for 'admin': *******

Store password unencrypted (yes/no)? yes
A    /root/firstrepo/tags
A    /root/firstrepo/trunk
A    /root/firstrepo/branches
Checked out revision 1.