Fork me on GitHub

Installing Subversion on a Home Ubuntu Server

Article Index

This tutorial will describe how to install Subversion with SSL web access onto a home server. Subversion is a great way to keep track of a number of projects and have widespread access to all of your files. It doesn't matter if you are the only person that will be accessing the repository and don't need all of the version control features, it is still a great way to keep an eye on your projects and make sure you have your information wherever and whenever you need it.

This tutorial uses Ubuntu Server 8.04 with Apache2, OpenSSL, and WebDAV. It assumes that you have a properly setup server including Apache and OpenSSL, at least a little Linux knowledge, and access to the Linux command prompt with sudo access. This tutorial is geared toward the home Linux server and assumes that your ISP blocks all incoming ports below 1024.

9/1/2011 Update: This tutorial has also been tested on Ubuntu 10.04LTS and works without issue.

If you need information on setting up your Ubuntu Server, HowToForge is a great place to look. Checkout The Perfect Server - Ubuntu 8.04 for more information.

1. Install The Software

The first step in getting your Subversion server up and running is to install the necessary software.

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

If you get any errors from the install, they will most likely be dependancy errors. Check through the message that you get, install any dependancies, and reissue the command. If you already have your server setup and running, you probably won't encounter any problems.

2. Add a group for subversion

Secondly, you need to add a group to the system for the subverion users. I called this group svnuser.

sudo addgroup svnuser

3. Add users to the subversion group

You will need to add any users that will have access to subversion to the subversion group. In order to make sure you have proper web access, you must also add the web user (www-data) to the subversion group.

sudo usermod -a –G svnuser www-data
sudo usermod -a –G svnuser user1

4. Create a place on the server for the repository

At this point, you have a decision to make.

First of all, subversion repositories are generally stored either at /srv/svn, /usr/local/svn, and /home/svn. For the purpose of this tutorial, I will put it at /usr/local/svn.

Secondly, you need to consider what domain you will be using to access the repository. I have a domain, we'll call it www.example.com, that is hosted on a commercial server. I'm going to point a DNS record under the subdomain svn to my home IP address. I have a dynamic IP address at home, but it hasn't changed in the last two years, so I'm comfortable doing this. If your home IP address changes more often, you may want to consider getting a dynamic host through a company like DynDNS. You can setup a domain like myhomesvn.dyndns.org, and access the repository through that domain.

For the purpose of this tutorial, I'm going to use the first option and assume that we are accessing the repository through the domain svn.example.com. Once you have settled on a name, issue the following command, replacing svn.example.com with the name you chose:

sudo mkdir –p /usr/local/svn/svn.example.com