Joe Maller.com

How to install Subversion on a shared host

I’ve hosted this site and several others LiquidWeb’s shared servers for probably eight years. They are without question, the most dependable host I’ve ever used. [see update]

But LiquidWeb doesn’t offer Subversion. And I will no longer do web work without it.

For some time I’d been considering leaving LiquidWeb because the lack of svn was now hindering work on my own sites. For the same reason, I’ve had to pass them over several times when clients asked for hosting recommendations. Then the other night, I stumbled across a discussion about installing Subversion on a shared host. Why didn’t I try that years ago?

Installation Instructions

These instructions assume basic proficiency with the Unix command line. Note that the goal is to install the SVN client, plan on hosting your repositories somewhere else.

Connect to your account with ssh and create a working directory, mine’s called _src:

cd
mkdir _src
cd _src

Next, use wget to pull down the subversion sources. You could also use curl, but wget does the same with less typing. Choose a version from this list of Subversion sources. The parallel “subversion-deps” download includes all dependent sources required to build Subversion.

wget http://subversion.tigris.org/downloads/subversion-1.4.6.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.4.6.tar.gz

Next, untar the sources and dive into the directory:

tar -xzvf subversion-1.4.6.tar.gz
tar -xzvf subversion-deps-1.4.6.tar.gz
cd subversion-1.4.6

One step, maybe (32-bit?)

At this point, depending on your server configuration, you might be able to install with the following two commands:

./configure --prefix=$HOME --without-berkeley-db \
     --with-ssl --with-editor=/usr/bin/vim \
     --without-apxs --without-apache
make && make install

That worked on some servers but not others, I spent many hours clumsily trying to figure out why. I found that the build process was linking to external libraries instead of the ones in subversion-deps, despite the configure directives.

On the 64-bit server (x86_64) this was a big problem, even though everything worked normally on two 32-bit (i686/i386) servers. Check server architecture with either arch, uname -a or cat /proc/cpuinfo. The solution for 64-bit machines is to build the three main components beforehand and then tell Subversion where to find them.

Build them, use them (64-bit?)

The following commands systematically build each of the three shared libraries from the Subversion-deps sources. This should guarantee that the files Subversion links to will be compatible. In each step, we explicitly enable compilation of shared libraries and prefix the files into our home directory. This looks worse than it is.

Build apr, apr-util and neon, in that order:

cd apr
./configure --enable-shared --prefix=$HOME 
make && make install

cd ../apr-util
./configure --enable-shared --prefix=$HOME \
     --with-expat=builtin --with-apr=$HOME \
     --without-berkeley-db
make && make install

cd ../neon
./configure --enable-shared --prefix=$HOME \
     --with-libs=$HOME --with-ssl
make && make install

With those out of the way, we can now configure and build Subversion. According to the notes in Subversion’s configure file, the --with-ssl flag is not necessary since it’s just passed to neon and we already built neon. --without-apxs and --without-apache prevent Subversion from trying to install its Apache modules. Remember to point to the libraries we just built (in $HOME): (note: you may need to add the --without-serf flag as well, see this comment)

cd ../
./configure --prefix=$HOME --without-berkeley-db \
     --with-editor=/usr/bin/vim --with-apr=$HOME \
     --with-apr-util=$HOME --with-neon=$HOME \
     --without-apxs --without-apache
make && make install

Subversion should now be installed! It’s likely you already have :~/bin in your user $PATH, if so, you can try it out right away:

svn --version

   svn, version 1.4.6 (r28521)
      compiled Jan 29 2008, 11:05:47

So far, I’ve run this against two LiquidWeb shared accounts, one LiquidWeb CPanel container on a VPS and a HostingMatters shared account running JailShell. After some limited testing accessing different repositories with https and svn+ssh, everything seems to be working.

Now I just need to figure out where to put my repositories, here are some free Subversion hosts I’ve used or are considering:

Two other sites which aren’t free, but I’m keeping in mind for the future: Wush and Project Locker.

The getting there was the hardest part

While I was finally able to streamline this down to a fairly simple process, it was not easy to get there. I don’t do much compiling from source, so I’m very clumsy about troubleshooting. If any of these steps can be simplified, please leave a note.

Here are some of the errors I saw along the way:
/usr/lib/libexpat.so: could not read symbols: File in wrong format
/usr/lib/libexpat.so: could not read symbols: Invalid operation 
/home/joe/_src/subversion-1.4.6/neon/src/.libs/libneon.a: could not read symbols: Bad value 

The first two errors indicate that the build had grabbed the 32-bit libexpat from /usr/lib instead of the 64-bit version from /usr/lib64. However, redirecting to the 64-bit libraries introduced other problems such as the libneon.a bad value error. As mentioned above, what I needed to do was pull libraries from the subverson-deps code. To use those, I needed to compile each one first.

Resources:

Related: How to install Git on a shared host

Update, November 2010: Sometime this year Liquid Web disallowed compiler access. I now host my sites at WebFaction and A2 Hosting.


  • http://www.davidmcdonald.org David McDonald

    Thanks for this great step by step guide. I am trying to install SVN on Bluehost.com, following the steps above but keep getting this error on the final SVN make install command:

    /usr/bin/ld: /home/prospet5/lib/libneon.a(ne_request.o): relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC
    /home/prospet5/lib/libneon.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make: *** [subversion/libsvn_ra_dav/libsvn_ra_dav-1.la] Error 1

    I would be grateful for any help with my issue. Thanks again.

  • http://www.davidmcdonald.org David McDonald

    Sorry, a bit more info – uname -a returns:

    Linux box347.bluehost.com 2.6.22-9_1.BHsmp #1 SMP Fri Sep 28 23:36:16 MDT 2007 x86_64 x86_64 x86_64 GNU/Linux

  • http://www.joemaller.com Joe

    @David, I think the ld warning is saying it can’t read the locally installed libneon. Did you follow the 64-bit instructions? And if you did, did you paste them as one block or enter the commands one at a time? Were there errors with the make && make install for the neon library?

  • http://www.davidmcdonald.org David McDonald

    Hi Joe,

    I pasted the commmands one at a time. These errors are happending with the make install for subversion at the end of the process you outline above.

    How would I see if there were errors with the make && make install for the neon library?

  • http://www.careers-with-navtej-kohli.com navtej kohli

    Thanks for the info… regards… navtej kohli.

  • http://www.joemaller.com Joe

    @David McDonald Try splitting the “make” and “make install” onto separate lines, I suspect there might be an error after neon’s make command, if not sooner. I looked into setting up an account at BlueHost, but they’re kind of expensive for short-term accounts. I think I’ve got a similar server on an account with A2hosting, I’ll give it a try there and see what happens.

  • http://www.waveimagingtechnology.com Morgan Brown

    Thanks for the help–I’ve learned snippets of this stuff on my own, but your solution was comprehensive, and helped me out of a Neon hole.

    Morgan

  • http://www.waveimagingtechnology.com Morgan Brown

    One thing I should mention, to get rid of the “libneon.a: could not read symbols: Bad value” error, another poster at SVNForum.org mentioned having to set the environment variable

    EXTRA_CFLAGS=-L/usr/lib64 -fPIC

    It turns out that the neon directory needs the same flags, but doesn’t read them from the same $EXTRA_CFLAGS env variable. In building neon, you ALSO have to set

    CFLAGS=-L/usr/lib64 -fPIC

    Argh! It’s not like 64-bit is leading edge at this point!

    Morgan

  • Colin Burn-Murdoch

    @David McDonald

    I found the solution to this at http://yavin4.anshul.info/category/linux/

    neon should be compiled seperately, using –enable-shared with configure.

    So I did:

    svn-1.4.6/neon]$ ./configure –prefix=/home/myuser/system –enable-shared
    svn-1.4.6/neon]$ make && make install
    svn-1.4.6/neon]$ cd ..
    svn-1.4.6]$ ./configure –prefix=/home/myuser/system
    svn-1.4.6]$ make && make install

    and that got things running.

  • Shrop

    Joe,

    Thanks so much! I just upgraded to a 64bit CentOS VPS and my usual compile methods failed. I found this blog post and your 64bit instructions saved me big time. It worked perfectly.

    Thanks for putting this info out here. I too rely on svn for web work.

    Shrop

  • http://www.davidmcdonald.org David McDonald

    With an enormous amount of help from Colin, I finally got SVN working on Bluehost on a 64 bit box. Here’s how I did it if anyone is interested.

  • will

    brilliant!

  • http://www.ecohosting.cm Gord Fsich

    Thanks a million! I read so many posts that didn’t quit do it but your step-by-step got it done.
    Also on centOS 5 64bit.

    Good work. You the man, Joe.

    Gord

  • Hamy

    Thanks so much! Awesome. I really liked the errors along the way and the explanation.

    For anyone else, works fine on HostMonster

    Only problem I am having is that after everything works, nether svn or svnadmin are recognized commands. I am pretty new to bash though, so perhaps I am missing something.

  • http://www.paranoiaparadise.com T-Shirt Guy

    Thanks to people like you, dummies like me are able to install subversion on bluehost.

    I’ll try to give it back – somehow;-)

  • http://bulletsburning.com Nathanael Matthias Weiss

    On a 64-bit host using latest SVN 1.5.0,
    I had to add to add “–without-serf” to the main subversion ./configure.

  • http://www.joemaller.com Joe

    Thanks for the update Nathanael, I added a note to the post about that flag.

  • http://netsperience.org decibel.places

    I was beating my brains out until I noticed in your 64bit directions that

    berkeley-db

    is misspelled as

    berlekey-db

    and the same error is even repeated here

    http://www.justinball.com/2008/02/11/setting-up-subversion-on-bluehost/

    After a few failures, I installed Subversion 1.5.1 successfully on BlueHost shared hosting (including the –without-serf flag)

    I have posted the corrected/updated recipe at

    http://netsperience.org/content/installing-subversion-151-a-shared-host-0

  • http://netsperience.org decibel.places

    oops, had some trouble posting it with a teaser, anyway here is the corrected code:

    http://netsperience.org/content/installing-subversion-151-a-shared-host-ssh-commands

  • http://www.joemaller.com Joe

    Good catch, sorry about that. I updated the post to correct the problem.

  • http://www.cm3consulting.com Christian Jungers

    On our machines we had to add this environment variable in order to get the whole 64bit process to work:

    LDFLAGS=”-L/usr/lib64″; export LDFLAGS

    Otherwise we were seeing the error about the libexpat library format as mentioned in this page while building in the top level subversion folder.

    uname -a
    [Linux machine.domain.com 2.6.18-53.1.4.el5xen #1 SMP Fri Nov 30 01:21:23 EST 2007 x86_64 x86_64 x86_64 GNU/Linux]

  • http://www.designsandwich.co.uk David Rapson

    Thanks, it worked perfectly on my shared host. The only small problem was the fact that wget seems to be blocked by my host (uk2) but I just uploaded the .tar files directly instead and it worked fine.

    It hasn’t yet solved the problem whereby php files are not parsed when directly uploaded via sftp, they only seem to work when I use the cpanel gui. Which kind of stuffs up the whole version control thing, but that is the hosts fault so fingers crossed I’ll get it working soon

  • http://jonlandrum.com Jonathan

    Awesomeness. Thanks a million.

    And the miss-spelling is still present.

  • http://www.joemaller.com Joe

    ok, I think I got all the misspellings this time…

  • http://TeachersIway.com Richard Boldway

    Joe, thanks a million. Worked great out of the box. Since svn is capistrano required, how do host like BlueHost, that do not support Subversion, claim to be RoR ready?

  • Tom Hoen

    Joe – A truly exceptional post. Everything worked without a hitch installing svn at bluehost according to your instructions. Then, when I ran cap deploy:check from my deployment box, I was told svn could not be found in my path. Checking my $PATH variable, I see the bin folder containing svn.

    I am very new to linux, capistrano, and bluehost, so I apologize for my newbie-ness. Any suggestions would be greatly appreciated.

  • Tom Hoen

    Just figured out what I needed. I added the full path to the bin folder to my bashrc file. That seems to have done the trick.

    Once again, thanks for the great work and write up.

  • http://www.javawug.org Evans

    Thank you for this How-to –
    We have been able to install it on our server, just a breeze to get it work.

    I have also checked out your installing git, and that was smashing too. Great stuff!

  • Christoph

    thanks, worked perfect on hostmonster.

  • http://www.i-design.gr stathis

    Many, many thanks.
    It worked fine on 247host

  • Chris

    Hey thanks :d great tut! helped me install svn on my uk2.net shared server! couldnt work without svn now i use it all the time! cheers Chris

  • http://hottdhaka.com Ahsanul

    http://netsperience.org/content/installing-subversion-151-a-shared-host

    is a life saver. My best try was not good enough for setting subversion up on a Bluehost shared server! But this just worked!

    Thankx to you all! Thanx to the author!

  • http://www.sphur.com Tony

    ./configure –enable-shared –prefix=/home/sphurcom/svn

    i got this error installing svn in my shared host.. checking for c compiler default output file name. c compiler cannot create executables.. but the gcc files are available.
    i have ran this command to find the gcc is enable or not.
    rpm -qa | grep gcc
    gcc is installed in server.

    • http://www.joemaller.com Joe

      What host are you on and what is your $SHELL? Also, can you run `gcc –version`?

  • http://gnuski.blogspot.com lefty.crupps

    http://forums.cpanel.net/showthread.php?p=497041#post497041

    I cannot get this installed to get the ra_dav or ra_neon to work, any suggestions? Neither shows up as available RA Modules when I run ‘svn –version’

    • http://www.joemaller.com Joe

      Did you try the suggestion by Colin Burn-Murdoch’s comment about building neon with ./configure --prefix=/home/myuser/system --enable-shared?

      • http://gnuski.blogspot.com lefty.crupps

        http://forums.cpanel.net/showthread.php?p=497041#post497041

        If you follow that link ^^ you can see what I have done; I didn’t specify the –prefix= but I have –enable-shared and it’s not working for me. Neon gave no compile errors, nor does Subversion from what I have seen…

      • http://www.joemaller.com Joe

        I replied at your link, but might as well put it here too.

        Unless it’s your server and you’re installing as an admin, you need the prefix. Otherwise make will attempt to install somewhere you don’t have permission to write to. I’m surprised you’re not seeing errors about that.

        Try adding the prefix to all components of the installation and linking to the libraries you compiled in your own home folder.

        • http://gnuski.blogspot.com lefty.crupps

          I am the admin and it is my server (well, a client’s server), sorry for not clarifying that. It’s just that your HowTo was very good compared to the others out there. I appreciate the response, but still this isn’t working. Maybe I’ll try it all again…

  • http://gnuski.blogspot.com lefty.crupps

    Here is my most recent failed attempt, as root on CentOS 5.3:

    cd /usr/local/src/subverison/subversion-1.5.0/neon/

    make clean

    ./configure –with-ssl –with-pic –enable-shared –with-libs=/usr/kerberos –with-libs=/usr/lib –with-libs=/lib/ –prefix=/usr/local/subversion/

    make

    make install

    cd ..

    make clean

    ./configure –with-apxs=/usr/local/apache/bin/apxs –with-apr=/usr/local/apache/bin/apr-1-config –with-apr-util=/home/cpeasyapache/src/httpd-2.2.11/srclib/apr-util –with-ssl –with-neon=/usr/local/subversion/ –prefix=/usr/local/subversion/

    make && make install

    /usr/local/subversion/bin/svn –version

    svn, version 1.5.0 (r31699)
    compiled Apr 6 2009, 10:37:31

    Copyright (C) 2000-2008 CollabNet.
    Subversion is open source software, see http://subversion.tigris.org/
    This product includes software developed by CollabNet (http://www.Collab.Net/).

    The following repository access (RA) modules are available:

    * ra_svn : Module for accessing a repository using the svn network protocol.
    – handles ‘svn’ scheme
    * ra_local : Module for accessing a repository on local disk.
    – handles ‘file’ scheme

  • http://www.charlesyarbrough.com charles

    This worked great at http://www.dwhs.net thanks for the tutorial.

  • malcolm

    Hi getting problems on my shared host.

    Have downloaded subversion-1.6.2 and subversion-deps-1.6.2

    Have separately built neon, apr, and apr_util as described in the 64 bit section.

    When I come to do the last bit ie

    This is the configure that I went with:

    ./configure –prefix=$HOME –without-berkeley-db \
    –with-ssl –with-editor=/usr/bin/vim \
    –without-apxs –without-apache

    when I run make && makeinstall I crash out with this error:

    make: *** [subversion/libsvn_subr/sqlite.lo] Error 1

    Not quite sure what to do here now. Was wondering if needed to download and also build sqlite.

    Any help would be appreciated

    Thanks

    Malcolm

    • http://www.joemaller.com Joe

      Take a look at this mail thread which seems the same as what you’re seeing. You might need to specify a specific version of sqlite.

  • http://www.kieranfarr.com kfarr

    Thanks! You’re a lifesaver!! Got this working on a webfaction shared server after I had a dismal time trying to compile on my own. :(

  • http://BuildServer Stuart

    Joe,

    I am trying to upgrade Subversion 1.4.5 to 1.6.3. I have followed the instructions on this page and successfully installed 1.6.3 as a first step

    I am not sure on how to upgrade the 1.4.5. I read it on http://subversion.tigris.org/svn_1.6_releasenotes.html. It states that “To upgrade an existing installation, just install the newest libraries and binaries on top of the older ones.”

    Could you please let me know whether it means that I need to copy the latest apr, apr-util, neon libs and binaries along with the ones of SVN 1.6.3 over 1.4.5?

    Thanks,

    Stuart

  • Nouha Terzi

    Hi all,
    I tried to install subversion 1.5.0, I followed this guide but I had this error:

    /lib/libneon.so: undefined reference to `SSL_CTX_set_client_cert_cb’
    collect2: ld returned 1 exit status
    make: *** [subversion/svn/svn] Error 1

    Could you please help me.

  • http://comcast.net Daryl

    Thanks so much for this… it was driving me crazy trying to get svn installed on an old solaris box and your tips did the trick!

  • EDM

    @Nohua Terzi:

    I had the same error on a Solaris 10 SPARC. The problem seems to be that the system LD_LIBRARY_PATH had /usr/local/lib as the first item and that was overriding the need to use the CollabNet supplied libraries. Here is a wrapper script that fixes the problem by putting the libraries included with the client first in LD_LIBRARY_PATH only on execution of the subversion client. You will need to change the paths to match the details of your local installation.

    #!/bin/bash
    LD_LIBRARY_PATH=/opt/CollabNet_Subversion/lib/:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH
    /usr/local/bin/svn $*

  • http://limedaley.com/ Jon Daley

    Thanks, works for subversion 1.6.9 on hostmonster.

  • http://ratemygoat.com duncan

    great post, I was pretty surprised not to see svn installed from the get go (seems pretty standard to me) but this post made the install take ~5 mins. couldn’t have been easier. installed 1.6.9 btw on i686 and the commands under 32 bit option worked like a charm. thanks again!

  • Jaime

    Hello..

    I have configured subversion in my bluehost account at the following folder:

    ~/public_html/subversion

    When I run # svn –version, this is the response:

    svn, version 1.6.11 (r934486)
    compiled Jun 5 2010, 17:41:25

    Copyright (C) 2000-2009 CollabNet.
    Subversion is open source software, see http://subversion.tigris.org/
    This product includes software developed by CollabNet (http://www.Collab.Net/).

    The following repository access (RA) modules are available:

    * ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
    – handles ‘http’ scheme
    * ra_svn : Module for accessing a repository using the svn network protocol.
    – with Cyrus SASL authentication
    – handles ‘svn’ scheme
    * ra_local : Module for accessing a repository on local disk.
    – handles ‘file’ scheme
    * ra_serf : Module for accessing a repository via WebDAV protocol using serf.
    – handles ‘http’ scheme
    – handles ‘https’ scheme

    Inside subversion folder I created other folder called “projects” where I plan to create all repositories. after going to that folder, I issued “svnadmin create myrepos” and all folder structure myrepos was created.

    The great problem is that I cannot access the repository from my client. If I try to use http scheme (http://svn.domain.com/myrepos), the repository folder list is shown in the browser, and with svn scheme a cannot access it (using Zend Studio SVN plugin).

    Any idea?
    Thanks

    • http://www.joemaller.com Joe

      It’s been a while, but if I remember correctly, you will only have read access via http, use ssh if you will be writing.

  • http://www.pankajdangi.com Pankaj
  • Alec

    It was all working great, but now there’s what seems to be a simple error.

    In the “make install” part of

    cd apr
    ./configure –enable-shared –prefix=$HOME
    make && make install

    I’m getting an error at the end where the output looks like this:

    if [ ! -d /include/apr-0 ]; then \
    /home1/alecnewm/public_html/private/src/subversion-1.4.6/apr/build/mkdir.sh /include/apr-0; \
    fi;
    mkdir /include
    mkdir: cannot create directory `/include': Permission denied
    mkdir /include/apr-0
    mkdir: cannot create directory `/include/apr-0′: No such file or directory
    make: *** [install] Error 1

    As far as I see, the prefix was ignored at this part, and it’s trying to make these directories right under root.

    How can I fix this? Thanks in advance.

    • Alec

      Actually, I just fixed it myself. I’m interfacing with the shell in a weird way, so variables like $HOME weren’t interpreted properly. So now I manually put them in, so it’s working great! Thanks for this how-to.

  • http://terabyte-hosting.com Terabyte Hosting

    Joe,
    perfectly written. i did see one issue, that i just made a note of on a VPS install. it complained about the –enable-shared. i am installing this on several of my clients VPS’s, and have only noticed this issue with ‘unrecognized variable –enable-shared

    other than that, perfect, lifesaver for those who are on shared hosting with SSH access and desire having svn.

  • minway

    It works well on my Bluehost account.

    Thanks a lot for your sharing.

  • Andre Mariano

    Hi, I have an account in hostmonster, I’m kind a newbie in linux. I installed everything correctly and it even shows svn –version, but I don’t know what is the link for me to connect to the svn, I don’t even know where is my repository location =//
    Thanks in advance

  • http://devzing.com/ Wayne Allen

    Save yourself a ton of time and use one of the dedicated Subversion hosting companies like mine: http://devzing.com/subversion-hosting

  • Olivia Jennifer

    Transparency is a must in scrum
    rules as it allows important aspects of the process to be visible to all the
    members who are responsible for the result. Since every team member should
    understand it is always advisable to use a common “terminology” so that reviews
    can be shared by all.

  • Kylie Wilson

    To stop making avoidable
    mistakes in project management one can also try attending good PMP classes conducted by
    any of the PMI registered REP’s for gainig expertise best processes of project
    management. Any good PMP prep
    course
    will provide students with lots of actionable insights in
    project management along with preparing them for PMP certification.