Subversion Server on Raspberry Pi, part 1


These are my notes on how I configured a Raspberry Pi to run Subversion via an Apache server with secure Internet access and automated daily backups to Dropbox. The image below shows the configuration I was aiming for:

SVN RPi Layout

Until last week I’d been managing a couple of Subversion repositories on an old and noisy PC running the excellent CollabNet SubversionEdge. I’d also been looking for a project for my Raspberry Pi to help me learn a little Linux and some Python scripting. Finally I wanted a new system that could be put together by other people I work with, primarily the imaging specialists at Amber Optix whose Subversion repository I manage.


* MacBook Pro: although I’m primarily a Windows developer I work on a MBP retina with a solid state drive because, well, it’s just awesome. I run virtual machines, courtesy of VMWare Fusion, manage my notes in Evernote, my files with Dropbox, and OS X for web, email, IOS development and everything else. TortoiseSVN provides the Subversion interface via Windows Explorer.

* Raspberry Pi, Model-B, with 4Gb SD card, connected via Ethernet to my router. (My router is an Apple Time Capsule in Bridge Mode, connected to a Sky ADSL modem/router).

Installing the Operating System

(Another neat article here on how to do this).

Download the latest version of Raspbian “Wheezy” from (version 2013-07-26 at the time of writing). Unzip the downloaded file to get the operating system image. E.g.

  • 2013-07-26-wheezy-raspbian.img

Before the OS image can be copied onto the SD card we must find the device name. One technique is to list the free disk space of all devices on the MBP with the SD card removed, then repeat the listing with the SD card inserted:

With the SD card not inserted:

$ df -lH
Filesystem                          Size   Used  Avail Capacity  iused    ifree %iused  Mounted on
/dev/disk0s2                        250G   205G    44G    83% 50217398 10852042   82%   /
localhost:/Ev5H8qvZlfqLy7rY7p0zks   250G   250G     0B   100%        0        0  100%   /Volumes/MobileBackups

With the SD card inserted:

$ df -lH
Filesystem                          Size   Used  Avail Capacity  iused    ifree %iused  Mounted on
/dev/disk0s2                        250G   205G    44G    83% 50217398 10852042   82%   /
localhost:/Ev5H8qvZlfqLy7rY7p0zks   250G   250G     0B   100%        0        0  100%   /Volumes/MobileBackups
/dev/disk2s1 59M 19M 39M 34% 512 0 100% /Volumes/boot

This identifies /dev/disk2s1 as the SD card device, where 2 is the disk number.

We’re going to use the dd command to copy the image to the SD card, but we must first  unmount the Pi it so that we have full access to it:

$ diskutil unmount /dev/disk2s1

Then we copy the OS image to the device using the dd command:

$ sudo dd bs=1m if=./Downloads/2013-07-26-wheezy-raspbian.img of=/dev/rdisk2

Note that the destination is formed of /dev/rdisk{x} where x is is the disk number seen earlier with the df -lH command.

Once the block copy is complete we should results similar to those shown below:

1850+0 records in
1850+0 records out
1939865600 bytes transferred in 268.153202 secs (7234169 bytes/sec)

Insert the card into the Raspberry Pi – don’t power up yet.

Connecting to the Pi without a monitor

The Pi comes with a HDMI slot but in my office I don’t have another monitor and I wanted to be able to do everything with just the MBP and terminal sessions.

This site has useful info on configuring the Pi for a variety of routers. I have a Sky router so I logged into the administration pages and looked for the list of connected devices, first with the Pi disconnected and then with it connected:


I then used another administration page to reserve the address for the Pi:


Once the Pi’s IP is fixed on the router we can continue. Run a terminal session and use SSH (Secure Shell) to gain access to the Pi:

$ ssh pi@

[Note: if this procedure has been performed before the initial SSH may fail: in this case use the following to remove all keys belonging to the remote host (the Pi) from the locally stored host information:

$ ssh-keygen -R

Repeating the SSH command will now work.]

After the first login the output will be similar to:

$ ssh pi@
The authenticity of host ' (' can't be established.
RSA key fingerprint is 88:8b:92:32:13:d1:0b:3d:10:a6:a0:d7:08:a5:d1:66.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
pi@'s password: {raspberry, the default password}
Linux raspberrypi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'

Prepare the PI

Before starting on the Subversion and Apache installation it’s worth getting the OS updated as much as possible. From within an SSH session run:

$ sudo raspi-config

The following screen will appear:


Select option 1 to expand the file system, then reboot the device.

Tip: to reboot the Pi from the SSH session use:

$ sudo shutdown -r now

Next we’ll change the Pi default user’s password:

$ sudo passwd pi

And then we’ll add a new user for general use so that the Pi user is reserved for purely administrative tasks – not necessary but seems to be the normal pattern for Linux systems. For this walkthrough the user jon will be used as the main user on the Pi and in the Subversion user list.

$ sudo adduser jon

We’ll grant this user the ability to use sudo to perform key tasks. If we don’t do this then any attempt to use sudo from the jon account will result in a message like this:

jon is not in the sudoers file. This incident will be reported.

So we use:

$ sudo usermod -aG sudo jon

Then we log out using logout and connect via ssh again but this time for the jon account:

$ ssh jon@

Finally we will update the software on the PI using these two commands:

$ sudo apt-get update
$ sudo apt-get upgrade

That’s the basic Pi setup complete. In the next part I’ll cover how I configured Subversion.

One thought on “Subversion Server on Raspberry Pi, part 1

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