Install subversion on Linux without root access
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.
Requirements
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
/home/watrous |
/home/watrous
So I chose to install all my software in
/home/watrous/programs |
/home/watrous/programs
This will ensure that I have full permissions to write the necessary files.
Steps
Download requirements
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 |
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.
sha1sum subversion-1.7.5.tar.bz2 |
sha1sum subversion-1.7.5.tar.bz2
Extract Sources
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 |
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.
- apr
- sqlite
- zlib
- openssl
- libxml2
- neon
- subversion
Clean first
If you’ve already performed some of the steps listed below, don’t forget that it may be necessary to run
make clean |
make clean
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 |
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 |
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 |
cd apr-iconv-1.2.1 ./configure --with-apr=/home/watrous/apr-1.4.6 --prefix=/home/watrous/programs make make install
SQLite
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 |
cd sqlite-autoconf-3071201 ./configure --prefix=/home/watrous/programs make make install
ZLib
ZLib is also very easy to configure, build and install.
cd zlib-1.2.7 ./configure --prefix=/home/watrous/programs make make install |
cd zlib-1.2.7 ./configure --prefix=/home/watrous/programs make make install
OpenSSL
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 |
cd openssl-1.0.1b ./config --prefix=/home/watrous/programs/ make make install
Libxml 2
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 |
cd libxml2-2.8.0 ./configure --prefix=/home/watrous/programs/ make make install
neon
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 |
cd neon-0.29.6 ./configure --with-ssl --with-libs=/home/watrous/programs/ --prefix=/home/watrous/programs/ make make install
Subversion
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 |
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.
~/programs/bin/svn help |
~/programs/bin/svn help
Path
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.
export PATH=$PATH:/home/watrous/programs/bin |
export PATH=$PATH:/home/watrous/programs/bin
I can make this more permanent by adding PATH=$PATH:$HOME/programs/bin to my .bash_profile.
Conclusion
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.
Sharing
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.
Related
Comments
Leave a Reply to Justin Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Hi Daniel,
Thank you very much for posting the documentation on this work-around, it seems extremely useful. That being said, some of the urls have changed for the wget statements. How did you go about finding them originally? Just as an fyi, the following are still available:
http://www.sqlite.org/sqlite-autoconf-3071201.tar.gz
http://mirrors.gigenet.com/apache//apr/apr-iconv-1.2.1.tar.bz2
http://www.openssl.org/source/openssl-1.0.1b.tar.gz
ftp://xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz
http://www.webdav.org/neon/neon-0.29.6.tar.gz
*******
And the following have been removed (wget returned http error 404, file not found).
http://www.bizdirusa.com/mirrors/apache/subversion/subversion-1.7.5.tar.bz2
http://mirrors.gigenet.com/apache//apr/apr-1.4.6.tar.bz2
http://mirrors.gigenet.com/apache//apr/apr-util-1.4.1.tar.bz2
http://zlib.net/zlib-1.2.7.tar.bz2
*****
If there is another way to access these zip files, that would be great. Thanks again for your time and consideration, I very much appreciate it.
Thanks and Regards,
Justin
Justin,
https://apr.apache.org/download.cgi
http://sourceforge.net/projects/libpng/files/zlib/1.2.7/
https://archive.apache.org/dist/subversion/
I found those through google. You might want to make sure all the same libraries are used, but I suspect they are.
After installation of all the tars and finally during Subversion “make” command, getting the error.
subversion-1.7.5/subversion/libsvn_subr/xml.c:440: undefined reference to `XML_SetElementHandler’
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/xml.c:441: undefined reference to `XML_SetCharacterDataHandler’
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/.libs/libsvn_subr-1.a(xml.o): In function `svn_xml_free_parser’:
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/xml.c:386: undefined reference to `XML_ParserFree’
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/.libs/libsvn_subr-1.a(xml.o): In function `svn_xml_parse’:
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/xml.c:405: undefined reference to `XML_Parse’
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/xml.c:411: undefined reference to `XML_GetCurrentLineNumber’
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/xml.c:413: undefined reference to `XML_GetErrorCode’
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/xml.c:413: undefined reference to `XML_ErrorString’
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/.libs/libsvn_subr-1.a(xml.o): In function `svn_xml_make_parser’:
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/xml.c:353: undefined reference to `XML_ParserCreate’
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/xml.c:355: undefined reference to `XML_SetElementHandler’
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/xml.c:358: undefined reference to `XML_SetCharacterDataHandler’
/app/portable_svn_client/subversion-1.7.5/subversion/libsvn_subr/xml.c:375: undefined reference to `XML_SetUserData’
/app/portable_svn_client//lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler’
/app/portable_svn_client//lib/libaprutil-1.so: undefined reference to `XML_StopParser’
collect2: ld returned 1 exit status
make: *** [subversion/svn/svn] Error 1
Could you suggest here .what is missing??
I followed every step as mentioned above without any error and subversion directory contains bin directory.But could not able to run svn help from subversion bin
I am getting
-bash : svn: command not found
Are you sure you’re using the full path to the compiled binary? Maybe you could add it to your path…
The software community needed this article. Svn articles 10 years old and more are filling up search engine results. Besides showing non-root, it’s also less than 15 years old!