Install SVN on Linux

This covers installing subversion from a source tarball, for client-type uses. This document is based on an install of Subversion-1.4.3.tar.gz, but the install procedure should be similar for other versions as well. This does NOT cover installing Subversion as a server - some other steps are required for that. And it does not cover the procedure for compiling the 'bleeding-edges' version of subversion, which is a little different and more complicated (starting with the fact that you need subversion already installed in order to do it...?)

Required Software
For its functionality, subversion makes use of (depends on) a number or other pieces of software, all of which are also available for free. You must install these pieces of software before installing subversion. In many cases, some or all of the required software will already be installed on your system.

At the least, you will need to make sure these are installed correctly:

APR and APR-Util
These are the Apache Portable Runtime (APR) and its utility (APR-Util). Both must be version 0.9.7 or better. These provide a set of APIs that map to the OS - a layer between subversion and the OS which helps makes subversion platform independent. If you already have Apache2 installed then you already have the APR and APR-Util installed as well, so all you need to do is find them (more on that in Install APR and APR-Util)

zlib
zlib is a library with a number of compression and decompression functions, used by Subversion internally. This is usually installed so feel free to start the installation without checking, just remember that if the installation fails, it might be because zlib is not installed.

Neon
You will need neon installed in order to access the Greenstone repository over the internet, via WebDAV. Neon ensures that the subversion client program can handle repositories hosted on http, not just those on a local disk. (Also, if you are going to be hosting repositories over http, you will need neon so you can test those repositories.)

A note on dependencies
Subversion offers a dependencies tarball, containing APR, APR-Util, Neon and zlib. Instructions on using this are in the INSTALL file in the root directory of the subversion tarball. However, if you are installing on a system which already has some of this software installed, a subversion installation which tries to install new copies of them might not go smoothly. For that reason, I recommend checking what you have and don't have installed on your system first, and installing what's missing yourself, before installing subversion.

Depending on the features of subversion that you wish to use, other software might be required for your installation. For example, if you want repository files stored in a BDB database rather than on disk, then BDB will need to be installed prior to installing subversion. For a first install, I recommend installing only the software listed above, as this is all that is required to get a good working subversion with all the main features. Advanced users can read the INSTALL file in the source tarball's root directory for more information on advanced features.

Installation
First install subversions dependency software, then install subversion itself. I prefer to store source code for a given piece of software in /research/oranfry/sources/ (where X.X.X is the version number) and install binaries to /research/oranfry/. These install instructions reflect this preference, to please adjust them for your own preferences.

If you have Apache2
If you have Apache2 installed, you don't need to install APR and APR-Util. They are both bundled with Apache2, so will already be installed on your system when it comes time to install subversion.

All you need to do for this step if you have Apache2 is to locate the apr-1-config and apu-1-config programs. They should be in the HTTPD_HOME/bin directory, and may be named slightly differently. For example, they might simply be named apr-config and apu-config</tt>. Remember the location of these programs for use in the last step, Install Subversion Itself

If you don't have Apache2
If you don't have Apache2, you will need to install APR and APR-Util. Download a recent version of each as .tar.gz</tt> tarballs from http://apr.apache.org/download.cgi, then do the usual  ./configure, make, make install</tt>. These commands need to be adjusted for the particular version you have downloaded. mkdir /research/oranfry/sources
 * 1) make a directory for my source code to go in

cd /research/oranfry/sources tar -xzf /path/to/apr-X.X.X.tar.gz cd apr-X.X.X ./configure --prefix=/research/oranfry/apr make make install
 * 1) install apr

cd .. tar -xzf /path/to/apr-util-X.X.X.tar.gz cd apr-util-X.X.X ./configure --prefix=/research/oranfry/apu --with-apr=/research/oranfry/apr make make install
 * 1) install apr-util

Now locate the apr-1-config</tt> and apu-1-config</tt> programs. In my case they are were at /research/oranfry/apr/bin/apr-1-config</tt> and /research/oranfry/apu/bin/apu-1-config</tt>. The program binary files may be named slightly differently, for example, they could simply be named apr-config</tt> and apu-config</tt>. Remember the location of these programs for use in the last step, Install Subversion Itself.

Install zlib
This fairly standard-issue, so is probably installed on your system already. If you really want to check, you could try to compile a C program with #include<zlib.h></tt> as the first line. If it compiles without error, zlib is installed. If not, installation instructions can be found at the zlib website.

Install Neon
Check if you have neon by running: which neon-config

If you have neon, a path to neon-config</tt> will be outputted. Everything before /bin/neon/config</tt> is your neon home directory.

The neon version needs to be 0.25.x or greater. Check the neon version with: neon-config --version

If you have a suitible version of neon, make a note of the neon home directory for use in the last step, Install Subversion Itself.

If you don't have neon, or need to install a newer version, get a recent copy it from the WebDAV website in a .tar.gz</tt> archive. Install it with: cd /research/oranfry/sources tar -xzf /path/to/neon-X.X.X.tar.gz cd neon-X.X.X ./configure --prefix=/research/oranfry/neon make make install

Remember the neon home directory. In my case it is /research/oranfry/neon</tt>. This is used in the last step, Install Subversion Itself.

Install Subversion itself
Once all the required software is installed, subversion itself can finally be installed!

Download the most recent release of subversion (1.4.3 at the time of writing) from the Subversion website in .tar.gz</tt> format.

The basic installation sequence is below. Now is the time to make use of the paths to apr, apr-util and neon which you have noted down. Replace all paths with those for your own system. You may not need the --disable-neon-version-check</tt> switch - only use it if you have a very recent version of neon which svn mightn't know about yet.

cd /research/oranfry/sources tar -xzf /path/to/subversion-X.X.X.tar.gz cd subversion-X.X.X ./configure --prefix=/research/oranfry/subversion --without-apxs --with-apr=/research/oranfry/apr/bin/apr-1-config --with-apr-util=/research/oranfry/apu/bin/apu-1-config --disable-neon-version-check --with-neon=/research/oranfry/neon make make install

The configure may fail and require you to have sqlite3.c. The fail message will instruct you to grab the latest sqlite3 amalgamation tar (it will provide a link to a stable version that worked: http://www.sqlite.org/sqlite-amalgamation-3.6.13.tar.gz), decompress it and copy the sqlite3.c into a special new subdirectory of your subversion-X.X.X folder. mkdir /full/path/to/subversion-X.X.X/sqlite-amalgamation cp sqlite-3.6.13/sqlite3.c /full/path/to/subversion-X.X.X/sqlite-amalgamation/sqlite3.c After following these instructions in the fail message, re-run the configure step and then proceed to make and make install.

Now, subversion is installed in <tt>/research/oranfry/subversion</tt>. To use the <tt>svn</tt> command, put <tt>/research/oranfry/subversion/bin</tt> into your path.