Installing Subversion

Installing Subversion

As the Crixa resurrection picks up steam, we naturally need to deploy some support tools. I’ve always wanted to try out Subversion, a successor to the venerable Concurrent Versioning System (CVS), which is a version control system for documents. Installation log follows:

Before installing Subversion (SVN), I have to update my Apache 2.0 installation on my server. Bah. Now I have to remember how to do it. Note that everything here is done from the command line shell, and I’m compiling from source.

Compiling Subversion

Update: Feb 12, 2007 — Since I wrote this, there have been updates to svn and it’s easier to install if you want to run it as a simple daemon. For installing version 1.4.3 on my MediaTemple dedicated virtual server:

wget http://subversion.tigris.org/downloads/subversion-1.4.3.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.4.3.tar.gz
tar xvzf subversion-1.4.3.tar.gz
tar xvzf subversion-deps-1.4.3.tar.gz
cd subversion-1.4.3
./configure --prefix=/usr/local/svn --without-apache --without-berkeley-db
make
make install

The package subversion-deps-1.4.3.tar.gz has all the extra libraries you need to compile svn successfully. Note that I’m not compiling this with apache support. I’m just going to use svnserve as a simple daemon instead of as an Apache module.

Create Subversion User

Since svnserve will be running as a daemon, I need to create a user to run it as, so it doesn’t run as root.

groupadd svnusers
useradd svn

Run the Server

The command to startup the server as a daemon (-d), pointing to a particular repository (-r), is:

sudo -u svn /usr/local/svn/bin/svnserve -d -r /home/svn

The /home/svn/ directory was automatically created by the installation process. It listens at port 3690 by default.

Creating Repositories

Each repository needs to be created with the following command (I’m not using berkeley db, so I have to specify the file system type):

svnadmin create --fs-type fsfs /home/svn/name_of_repo
  • Note that this has to be done for each repository.
  • Make sure it’s owned by the svn user; if it isn’t, use chown -R svn /home/svn to do it.

Testing the Repository

To check that svn is seeing the repository, type svnlook info /reposdir on the command line.

You also have to set up svnserv.conf, in the repository’s conf directory. Edit svnserv.conf and set the auth-access, anon-access, password-db, realm settings:

[general]
anon-access = none
auth-access = write
password-db = passwd
realm = Name of Repository

This sets the repository so anonymous access is disallowed, but authenticated users are allowed.

Create passwd file in conf with a text editor (I just used Emacs). It just has [users] at the top, and username = passwd on each line.

[users]
jimbob = howdy
clara = tinny

Afterwards I chown and chgrp both files to the svn user and group.

Next, see if everything is working by accessing the repo with the following commands (name_of_repo is the same as what you used above for the svnadmin create command):

svn list --username jimbob --password howdy  svn://yourserver.com/name_of_repo

Note that repo is the name of the repository you created inside your repository folder; it’s just the one directory name, not the entire path. If it works, you shouldn’t see any output from the svn list command. To see something, try this:

svn log --username jimbob --password howdy  svn://yourserver.com/name_of_repo

If everything is well, the output will be something like “No commit for revision 0”, which means that the repository is empty. If it doesn’t work, check the file permissions again to make sure all repository directories are owned by the svn user.

Running the Client (TortoiseSVN)

After Installing TortoiseSVN on my Windows XP machine, I had to reboot it. Afterwards, the right-button context menus in the Windows File Explorer give you new options for SVN Checkout and a TortoiseSVN submenu.

Populating the Repository with TortoiseSVN

Set up a directory just the way you want. This is a good time to set up trunk, branch, and tags if you’re so inclined. I create a directory structure called _svn_project_init that I use for populating the repository. Right-click to IMPORT to the repository.

After populating the repository, it’s ready for us. I create a new directory called _svn_project and then I checkout into it. This creates what is known as your “working copy”.

3 Comments

  1. Daniel Tome 16 years ago

    Hi just a question. Since your not using apache. How do you connect with tortoise? Do you use svn:// ?
    thanks.

  2. Daniel Tome 16 years ago

    I just saw that testing the svn with svn://
    I just installed the latest version 1.4.6 on our server and your tips helped.

    thanks