HOWTO: Subversion
Posted: 27 Jul 2007, 19:04
Hi all,
This is a quick guide on how to get a recent version (1.4.2) of Subversion working on a Bubba server. I've tried to include as much info as possible but if something is not clear just let me know.
For this first part we need to run as root, so ssh into Bubba using your user account and then su to root. The default root password is excito, make sure you change this if you haven't already.
Next we need to edit the /etc/apt/sources.list in order to enable the Debian repositories, the initial version of the file looks like this:
To activate the Debian repositories we just need to uncomment the first three lines.
Unfortunately the standard repositories only contain version 1.1.4, this had some major issues for me and was incredibly slow. In order to get a more recent version we need add the Debian Sarge backports repository to our list, so we now have:
You'll also notice I updated my repositories to local mirrors (I'm in the UK). For a full list of the backport mirrors go here: http://www.backports.org/debian/README.mirrors.html
Now that we have the required repositories we need to refresh the package cache:
Now we can install Subversion:
The -t sarge-backports argument is required to enable the backport package (they're disabled by default).
Now that we have Subversion installed we need to get a server running. This guide only covers the svnserve server, not the WebDav Apache integration. For details on the two configurations and on how to set up the WebDav integration check out the Subversion book at: http://svnbook.red-bean.com/
Before we start the server we need something to serve. First we need to create a subversion user that will own the repositories. The reason for doing this is it prevents other users from messing with the repositories and also prevents them from looking at the passwd file (which stores the passwords in clear text). As root, run:
Now su to svn or open another ssh session as svn. To keep things tidy we will create a root for all of our repositories, in /home/svn run:
We are now ready to create out test repository, still as svn, run:
Obviously if you changed the repository root name then do the same in the command above. The final step in this process is to configure the repository. This is just a simple test repository so there isn't much to do, cd to the repository configuration folder, in this case:
There are two files we are interested in, svnserve.conf which contains the main server configuration, and passwd that contains the user accounts.
Edit the passwd file and remove the the two commented lines under the [users] section, add a new user and password e.g.
Now edit the svnserve.conf file, this already contains some example settings but they are commented out. The following lines should be uncommented:
I personally always disable anonymous read access (change the read to none for the first line).
Right, now were ready to start the server. There are two mechanisms for running svnserve, as a daemon or through inetd. I prefer the inetd approach as it means the server is not running constantly and it also means I don't have to mess about with init scripts
Just to be awkward I use xinetd (an inetd replacement), this is available through the standard debian repositories, to install it run the following as root:
If you don't want to use xinetd, the Subversion book covers the configuration for inetd (it doesn't cover xinetd).
Still as root, create a new file in the /etc/xinetd.d/ folder called svn, e.g:
The contents should be:
The important parts in this file are the user we want to run the process as (svn in our case), the port to run on (3690 is the default for Subversion) and the server arguments (-i to run as an inetd process and -r to specify the repository root).
Restart the xinetd process:
Ok, we should now be ready to import something into the repository. To keep things simple all we are going to do is create a standard repository structure and a single file. As any user other than svn (just to be on the safe side) run the following in the users home directory (although you can do it anywhere you have access really):
Now to import it just run the following:
If everythng is set up correctly you should get something like:
Now all that is left is to test checkout, so as the same user as before run:
Because we are the same user we don't need to supply the username and password again as Subversion caches it. You should get something like:
Obviously if you want to access the repository from another machine just substitute bubba (or whatever you've called it) for localhost in the URLs above.
Phew! Hopefully you found that useful, if you have any comments/corrections just let me know.
Cheers,
Darren.
This is a quick guide on how to get a recent version (1.4.2) of Subversion working on a Bubba server. I've tried to include as much info as possible but if something is not clear just let me know.
For this first part we need to run as root, so ssh into Bubba using your user account and then su to root. The default root password is excito, make sure you change this if you haven't already.
Next we need to edit the /etc/apt/sources.list in order to enable the Debian repositories, the initial version of the file looks like this:
Code: Select all
#deb http://ftp.se.debian.org/debian/ sarge main
#deb http://security.debian.org/ sarge/updates main
#deb http://ftp.se.debian.org/debian/ sarge non-free
deb http://update.excito.net/ bubba main
Unfortunately the standard repositories only contain version 1.1.4, this had some major issues for me and was incredibly slow. In order to get a more recent version we need add the Debian Sarge backports repository to our list, so we now have:
Code: Select all
deb http://ftp.uk.debian.org/debian/ sarge main
deb http://security.debian.org/ sarge/updates main
deb http://ftp.uk.debian.org/debian/ sarge non-free
deb http://www.uk.backports.org/ sarge-backports main contrib non-free
deb http://update.excito.net/ bubba main
Now that we have the required repositories we need to refresh the package cache:
Code: Select all
apt-get update
Code: Select all
apt-get -t sarge-backports install subversion
Now that we have Subversion installed we need to get a server running. This guide only covers the svnserve server, not the WebDav Apache integration. For details on the two configurations and on how to set up the WebDav integration check out the Subversion book at: http://svnbook.red-bean.com/
Before we start the server we need something to serve. First we need to create a subversion user that will own the repositories. The reason for doing this is it prevents other users from messing with the repositories and also prevents them from looking at the passwd file (which stores the passwords in clear text). As root, run:
Code: Select all
groupadd svn
useradd -m -d /home/svn -s /bin/bash -g svn svn
passwd svn
Code: Select all
mkdir repositories <-- or whatever you want to call it.
Code: Select all
svnadmin create /home/svn/repositories/test
Code: Select all
cd /home/svn/repositories/test/conf
Edit the passwd file and remove the the two commented lines under the [users] section, add a new user and password e.g.
Code: Select all
[users]
testuser = topsecret
Code: Select all
anon-access = read
auth-access = write
password-db = passwd
Right, now were ready to start the server. There are two mechanisms for running svnserve, as a daemon or through inetd. I prefer the inetd approach as it means the server is not running constantly and it also means I don't have to mess about with init scripts

Just to be awkward I use xinetd (an inetd replacement), this is available through the standard debian repositories, to install it run the following as root:
Code: Select all
apt-get install xinetd
Still as root, create a new file in the /etc/xinetd.d/ folder called svn, e.g:
Code: Select all
vi /etc/xinetd.d/svn
Code: Select all
# Subversion server
# default: on
service svn
{
socket_type = stream
protocol = tcp
user = svn
wait = no
disable = no
server = /usr/bin/svnserve
server_args = -i -r /home/svn/repositories
port = 3690
}
Restart the xinetd process:
Code: Select all
/etc/init.d/xinetd restart
Code: Select all
mkdir -p test/{trunk,branches,tags}
touch test/trunk/test.txt
Code: Select all
svn import test svn://localhost/test --username testuser --password topsecret -m "Initial Import"
Code: Select all
Adding test/branches
Adding test/tags
Adding test/trunk
Adding test/trunk/test/txt
Committed revision 1.
Code: Select all
svn checkout svn://localhost/test/trunk test2
Code: Select all
A test2/test.txt
Checked out revision 1.
Phew! Hopefully you found that useful, if you have any comments/corrections just let me know.
Cheers,
Darren.