Subversion Installation

From DreamHost
Jump to: navigation, search
The instructions provided in this article or section require shell access unless otherwise stated.

You can use the PuTTY client on Windows, or SSH on UNIX and UNIX-like systems such as Linux or Mac OS X.
Your account must be configured for shell access in the Control Panel.
More information may be available on the article's talk page.

The instructions provided in this article or section are considered advanced.

You are expected to be knowledgeable in the UNIX shell.
Support for these instructions is not available from DreamHost tech support.
Server changes may cause this to break. Be prepared to troubleshoot this yourself if this happens.
We seriously aren't kidding about this.

WAIT!!!. As of mid-2007, DreamHost has a pretty recent Subversion installed by default on hosts. See Subversion to see how to use it if that suits you. The instructions there are much simpler, and, unlike these ones, they are to some extent supported by DreamHost.

The Subversion Installation guide walks you through the instructions to install Subversion with and without Python bindings. Python bindings aren't required unless you are using Subversion with a package that requires it. You can follow the instructions to install the bindings for Ruby or Perl also if you replace several commands.

From Source

You may want to install your own subversion if you need something that the DreamHost pre-installed version doesn't provide (e.g. Python bindings). However, you can't access your manually created repositories via web.

A compromise would be to locally install the same version as the one provided by DreamHost and to use the DreamHost Panel to create the repository. You can then access the repository with your local tools and it should also be available via web.

Prerequisites

  • If you want to use Python bindings, install Python and SWIG locally.
  • If you want to use Ruby bindings, install Ruby locally.


Choose your subversion version

In order to be able to use your own compiled subversion with repositories created with the DreamHost Panel, you should choose the same version as the one installed in your host:

SVNVERSION=`/usr/bin/svn --version --quiet`

Alternatively, choose the version you like... the latest as of August 2007 is 1.4.5:

SVNVERSION=1.4.5

but, be warned that you may run into problems if you use an svnadmin to modify a repository created with the DreamHost Panel.

Downloading

Download both subversion and subversion-deps in the same directory so that the ./configure in subversion finds and builds the dependencies automatically.

mkdir -pv ${HOME}/soft
cd ${HOME}/soft
wget http://subversion.tigris.org/downloads/subversion-${SVNVERSION}.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-${SVNVERSION}.tar.gz
tar xzvf subversion-${SVNVERSION}.tar.gz
tar xzvf subversion-deps-${SVNVERSION}.tar.gz
cd subversion-${SVNVERSION}

Configuring

Choose an installation destination

If you use the Unix account setup you have already a ${RUN} environment variable set up (in .bashrc) and you install everything there.

If you install packages directly in your home directory (${HOME}), then type:

export RUN=${HOME}

If you install packages in other directory of your choice (e.g. packages directly under your home directory -${HOME}), then type:

export RUN=${HOME}/packages

(replace packages above by the directory name you want).

If you have installed your own version of Python, create an environment variable to hold the version number and another to hold the directory where packages are installed:

# ${PYVERS} Python version
export PYVERS=`${RUN}/bin/python -V 2>&1 | cut -d ' ' -f 2`
# ${PYLIBPKG} Python library site packages directory
export PYLIBPKG=`${RUN}/bin/python <<EOF
import sys
print sys.path[-1]
EOF`


Configure

Make sure that the versions you installed of Python, SWIG and Ruby (if you have them) are found in your ${PATH} before the DreamHost supplied versions (if you have installed them following the Environment Setup or Unix account setup then, they probably are OK).

Local SWIG

If you have compiled SWIG locally, set the following:

SVNSWIG=" --with-swig=${RUN}/bin/swig"

Python bindings

If you want Python bindings (with your locally compiled Python), set the following

SVNPYTHON=" PYTHON=${RUN}/bin/python"

Ruby bindings

If you want Ruby bindings (with your locally compiled Ruby), set the following

SVNRUBY=" RUBY=${RUN}/bin/ruby"

Run the configuration script

./configure ${SVNPYTHON} ${SVNRUBY} --prefix=${RUN} \
         --without-berkeley-db --with-ssl --enable-shared \
         ${SVNSWIG} 

Compile and Install

make
make install

Python Bindings

If you need to install the python bindings then do the following steps after you installed Subversion.

make swig-py
make install-swig-py
# tell your Python where to find the subversion bindings
echo ${RUN}/lib/svn-python > ${PYLIBPKG}/subversion.pth

Test Subversion and Python bindings before you continue.

If it returns "Module SVN not found", then you need to redo the SWIG and Subversion install until it returns successfully.
${RUN}/bin/python -c "from svn import client"

Ruby Bindings

The following instructions worked with a custom Ruby installation, gem installation and $GEM_HOME. But it should work with the standard install as well. Swig was already installed on my server. When installing subversion swig and ruby were found automatically.

make swig-rb
make install-swig-rb

Perl Bindings

make swig-pl-lib
make install-swig-pl-lib
pushd subversion/bindings/swig/perl/native 
perl Makefile.PL PREFIX=${RUN}
make install
popd

Troubleshooting

If when you try to use the make commands you get some warnings with .so files, you can try the following

cd ${RUN}/lib/python2.3/site-packages
mv libsvn libsvn.b0rk
ln -s /usr/lib/python2.3/site-packages/libsvn 
ln -s /usr/lib/python2.3/site-packages/svn


Precompiled Binary

Static builds of the Subversion software are available for Linux and can be installed in your home directory.

Go back to your home directory

cd $HOME

Download the latest subversion-VERSION-linux-x86.tar.gz. Replace VERSION with the version you want.

wget http://www.uncc.org/svntools/clients/linux/subversion-VERSION-linux-x86.tar.gz

Untar the package. Replace VERSION with the version you downloaded.

tar -xzvf subversion-VERSION-linux-x86.tar.gz

This will create a bin/ directory (if you don't already have it) and place the svn, svnadmin, svnserve, etc. binaries there.

See Also

Subversion