Install Subversion and Create a new source code repository

Subversion needs no introduction to the world of source code management. Subversion is a modern, network-aware version control system. It is an open source project distributed under Apache license by Apache foundation. The open source community has used Subversion widely: for example in projects such as Apache Software Foundation, Free Pascal, FreeBSD, GCC and SourceForge. CodePlex offers access to Subversion as well as to other types of clients. There are other large enterprises where Subversion is the first choice for version control purposes.

Subversion was created by CollabNet Inc. in 2000, and is now a top-level Apache project being built and used by a global community of contributors.

In this blog post, we’ll learn how to download and install subversion and create a new source code repository for us.

Downloading Subversion

Although Subversion is an Apache project, Apache does not build their own binary files for any operating system. The following URL provides URLs about the latest stable releases of Subversion built by third parties for all major operating systems:

If possible, use a package manager such as YUM or APT to manage the installation of other software.

You can download subversion from the site as per the host OS that is running on the machine.

Installing Subversion

The installation method varies depending upon the platform and distribution method. For example, you need to run below commands on the Ubuntu OSL

apt-get install subversion
apt-get install libapache2-svn

Install Subversion on Ubuntu OS
Install Subversion on Ubuntu OS

However, on the CentOS or Red Hat Operating System, you need to use below commands:

yum install subversion
yum install mod_dav_svn

To obtain the version information of svnserve, you can run the following command on the command line:

svnserve –version

This should throw an output like below:

Verifying if subversion is installed
Verifying if subversion is installed

If you cannot find the command, then edit the PATH environment variables to include the subversion directory.

Configuring the Subversion Server as a Service

The Linux installation process automatically creates an /etc/init.d/svnserve script. This starts the server when you start up your system.

To start the service manually, run the following command on the command line:

sudo /etc/init.d/svnserve start

Creating a Repository

First, we need to create a directory structure where we would like to store the all the source code repos. For this, we can use command like below:

mkdir -p /svn/repos/

We can then create the repository by using svnadmin utility for repo named say repo01:

svnadmin create /svn/repos/repo01

Create a new repo in the subversion
Create a new repo in the subversion

Above command assumes that the parent directory /svn/repos exists and that you have sufficient permissions to modify that directory, the previous command creates a new repository in the directory //svn/repos/, and with the default filesystem data store (FSFS). You can explicitly choose the filesystem type using the –fs-type argument, which accepts as a parameter either fsfs or bdb.

#Create an FSFS-backed repository
svnadmin create –fs-type fsfs /svn/repos/repo01

#Create a Berkeley-DB-backed repository
svnadmin create –fs-type bdb /svn/repos/repo01

After running this simple command, you have a Subversion repository. If you are sharing the repository among multiple users, you might want to implement hooks before you share it. However that topic is for another blog post as its a very large one.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s