You are here

installing subversion and vim on a shared host

I haven't used shared hosting for quite a while, but for a few sites I've worked on recently an account on a shared host seemed the best choice in terms of how much disk space and bandwidth they'd get for a very small cost.

One obvious problem with shared hosting though is the lack of control; I was careful to choose a package which provided up-to-date versions of apache, php and mysql but subversion was not installed, and the version of vim on the server didn't have support for some basic things like syntax highlighting.

It was quite easy to remedy this situation - by downloading the source code of subversion and vim, compiling my own local binaries, and finally adding them to my path.

the prep work

I suppose the main prerequisite for this is that you need SSH / shell access to your shared host.

You need to decide where you're going to put things - you almost certainly won't have permissions on a shared host to create directories and files outside of your home directory. Most shared accounts will have a directory called something like public_html inside the home directory for your account - you probably don't want to put source code and binaries in there, but other than that it's up to you...

You can simply install everything directly into your home directory, but I decided to create a new directory for the new applications I'm installing, in order to keep the top level of my home directory tidy and uncluttered. I decided to call my new directory opt which is a fairly conventional name for optional application software packages (although opt is usually just /opt in the root of the file system rather than inside a home directory). Inside there, I created a directory called src for all the source code I'd need to download.

mcdruid@sharedhost:~> mkdir -p opt/src<br>
mcdruid@sharedhost:~> cd opt/src

Installing vim

I downloaded the latest sources for vim using wget.

mcdruid@sharedhost:~/opt/src> wget <a href="ftp://ftp.vim.org/pub/vim/unix/vim-7.2.tar.bz2">ftp://ftp.vim.org/pub/vim/unix/vim-7.2.tar.bz2[/geshifilter-text]

Un-archive this file (giving tar the j option tells it to uncompress using bzip)

mcdruid@sharedhost:~/opt/src> tar jxf vim-7.2.tar.bz2<br>
mcdruid@sharedhost:~/opt/src> cd vim72/src

I now wanted to make two changes to the Makefile which comes with the vim sources (n.b. I'm editing the Makefile inside vim72/src - not the default one in vim72). I could use the vi command to do this - in the unlikely event that even this is not available on your shared host, perhaps try nano or pico. The two changes I wanted to make were to set:

  • CONF_OPT_GUI = --disable-gui (I uncommented line 323 in my Makefile)
  • prefix = $(HOME)/opt (this was on line 874 in my Makefile)

With those two options set, I simply had to compile and install.

mcdruid@sharedhost:~/opt/src/vim72/src> make && make install

This left me with some new directories inside my opt directory, one of which is bin, and this contains the new vim binaries.

Installing subversion

I only wanted to be able to use the subversion client on this host - my repositories are hosted elsewhere. I'm not sure how easy it would be to get the server side of subversion working on a shared host, as you'd probably need to install and load apache modules like dav_svn.

I downloaded the latest subversion sources (and the package which contains sources for some of subversion's dependencies), and then unarchived the tarballs.

mcdruid@sharedhost:~/opt/src> wget <a href="http://subversion.tigris.org/downloads/subversion-1.6.9.tar.gz<br>
mcdruid@sharedhost:~/opt/src>">http://subversion.tigris.org/downloads/subversion-1.6.9.tar.gz<br>
mcdru...</a> wget <a href="http://subversion.tigris.org/downloads/subversion-deps-1.6.9.tar.gz<br>
mcdruid@sharedhost:~/opt/src>">http://subversion.tigris.org/downloads/subversion-deps-1.6.9.tar.gz<br>
...</a> tar zxf subversion-1.6.9.tar.gz && tar zxf subversion-deps-1.6.9.tar.gz<br>
mcdruid@sharedhost:~/opt/src> cd subversion-1.6.9

This time we use configure to prepare for compilation with the options we want:

mcdruid@sharedhost:~/opt/src/subversion-1.6.9> ./configure --prefix=$HOME/opt --without-berkeley-db --with-ssl --with-editor=$HOME/opt/bin/vim --without-apxs --without-apache<br>
mcdruid@sharedhost:~/opt/src/subversion-1.6.9> make && make install

This again leaves us with the subversion binaries inside ~/opt/bin

Add the new binaries to PATH

We could now use our new binaries directly, but it makes life a lot easier to add the new ~/opt/bin directory to our path, so that we can use vim and svn as usual. You can do this several different ways, but I've added the following line to my .bashrc file

export PATH=$PATH:$HOME/opt/bin

If you then logout and in again (or just source your rc file), you should be able to confirm your new binaries are working by doing something like this:

mcdruid@sharedhost:~> vim --version<br>
mcdruid@sharedhost:~> svn --version

credits

The instructions for installing subversion are based on Joe Maller's guide:

Comments

Thank for a great guide, man. Everything worked out fanstically, except making the make file. For some reason, my downloaded version had newlines in long comments in two places, but with that sorted, everything worked out.