Today I needed to install subversion on a Linux host on which I don’t have root access. With root access the install would have been very simple. However, I couldn’t find a good tutorial showing how to go about installing the software just for the local user. This post goes through how I did that.
Subversion relies on several third party libraries. Some of these may already be available on your server. Others may not be, so you’ll need more than I show here. What I provide should give you a roadmap to find and install any remaining requirements
Where to install it
Without root access you’ll need to install subversion and other related software where you have file permissions. My home directory is
So I chose to install all my software in
This will ensure that I have full permissions to write the necessary files.
Start by downloading all the requirements that are needed. I did this using wget (I had to set the proxy in /etc/wgetwc or by exporting a value for http_proxy).
wget http://www.bizdirusa.com/mirrors/apache/subversion/subversion-1.7.5.tar.bz2 wget http://mirrors.gigenet.com/apache//apr/apr-1.4.6.tar.bz2 wget http://mirrors.gigenet.com/apache//apr/apr-util-1.4.1.tar.bz2 wget http://www.sqlite.org/sqlite-autoconf-3071201.tar.gz wget http://zlib.net/zlib-1.2.7.tar.bz2 wget http://mirrors.gigenet.com/apache//apr/apr-iconv-1.2.1.tar.bz2 wget http://www.openssl.org/source/openssl-1.0.1b.tar.gz wget ftp://xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz wget http://www.webdav.org/neon/neon-0.29.6.tar.gz
If you’re a concerned about security (and I suppose we all should be) it’s wise to confirm the published hash for the files that you download to make sure they haven’t been modified before being posted on a mirror site. The most common ways to do this include md5sum, sha1sum and pgp. Here’s an example showing how to verify the subversion download.
This next step will leave you with folder for each application. If you don’t want to clutter your home directory, you can create a working directory where you’ll extract all of these.
Next extract the source code for each. This is done using the tar command, but may be slightly different depending on the compression method used.
tar xjvf subversion-1.7.5.tar.bz2 tar xjvf apr-1.4.6.tar.bz2 tar xjvf apr-util-1.4.1.tar.bz2 tar xzvf sqlite-autoconf-3071201.tar.gz tar xjvf zlib-1.2.7.tar.bz2 tar xjvf apr-iconv-1.2.1.tar.bz2 tar xzvf openssl-1.0.1b.tar.gz tar xzvf libxml2-2.8.0.tar.gz tar xzvf neon-0.29.6.tar.gz
Now you’re ready to configure, compile and install each one. The order of installing these matters since there are dependencies between them. Here’s the order I followed.
If you’ve already performed some of the steps listed below, don’t forget that it may be necessary to run
to clear out existing binaries and ensure that your new build leverages other recompiled files.
Apache Portable Runtime (APR)
The Apache Portable Runtime has three components that need to be installed. The apr-util and apr-iconv depend on apr, so start with that first. From the directory where you extracted the sources based on the step above, run the following commands to configure, make and install apr. Notice that I ues the –prefix option. That’s the crucial element in this whole process since it’s what installs everything where you have permissions.
cd apr-1.4.6 ./configure --prefix=/home/watrous/programs make make install
Notice here that I have to tell the configure script where apr is. This satisfies the dependency.
cd apr-util-1.4.1 ./configure --with-apr=/home/watrous/apr-1.4.6 --prefix=/home/watrous/programs make make install
And finally apr-iconv.
cd apr-iconv-1.2.1 ./configure --with-apr=/home/watrous/apr-1.4.6 --prefix=/home/watrous/programs make make install
SQLite doesn’t have any dependencies in this case, so it’s really simple to make and install. This is one of the more likely to already be on your system, so you might want to check. SQLite is a fantastic, lightweight database that doesn’t require any configuration or server overhead.
cd sqlite-autoconf-3071201 ./configure --prefix=/home/watrous/programs make make install
ZLib is also very easy to configure, build and install.
cd zlib-1.2.7 ./configure --prefix=/home/watrous/programs make make install
OpenSSL is used indirectly by neon to accommodate SSL connections (repository URLs over HTTPS). If you plan to access subversion repositories over HTTP (without encryption) then you can skip this step).
cd openssl-1.0.1b ./config --prefix=/home/watrous/programs/ make make install
Libxml 2 is also use by neon to accommodate the webdav format.
cd libxml2-2.8.0 ./configure --prefix=/home/watrous/programs/ make make install
The neon libraries enable the webdav functionality on which subversion is built. Note that I use the –with-libs option to specify where to find the openssl libraries. If you have the openssl-devel packages installed, this may not be necessary.
cd neon-0.29.6 ./configure --with-ssl --with-libs=/home/watrous/programs/ --prefix=/home/watrous/programs/ make make install
Now we tie it all together with our call to configure. We need to tell the configure script where to find all the dependencies that we’ve just put in place and to install the finished program into our programs folder. Based on the steps above, here are the commands I used to configure, build and install subversion.
cd subversion-1.7.5 ./configure --without-berkeley-db --without-apxs --without-swig --with-zlib=/home/watrous/programs --with-sqlite=/home/watrous/programs --with-neon=/home/watrous/programs --with-ssl --without-pic --disable-shared --with-apr=/home/watrous/apr-1.4.6 --with-apr-util=/home/watrous/apr-util-1.4.1 --with-ssl --prefix=/home/watrous/programs make make install
Note that the –without-pic and –disable-shared options are to prevent collisions between the libraries we’ve installed above and similar libraries that may exist elsewhere in the system. In particular this may help resolve a conflict with the OpenSSL libraries.
At this point the subversion binary ‘svn‘ should be available in ~/programs/bin/svn.
It would be a bit of a pain to always have to type ‘~/programs/bin/svn’ to run subversion. So the next thing I did was to add my new programs/bin folder to the path.
I can make this more permanent by adding PATH=$PATH:$HOME/programs/bin to my .bash_profile.
That’s it. Now you have the subversion client installed for your local use on Linux without root access. Naturally this same process would work to install any software you need under your own account on a *nix host.
It’s worth noting that you still need permissions wherever your new svn binary intends to operate.
If you want to share your new subversion with other users on the same system, all you need to do is set the execute bit on your home, programs and bin directories and each binary that you want others to access. They can then add your programs/bin directory to their path and make use of any programs that you installed.