Monday, 3 February 2014

How to: Upgrade SVN to 1.7 on CentOS

After searching through the web, I managed to find bits and pieces about upgrading subversion from 1.6 to 1.7 on CentOS. Unfortunately, it is like unraveling a puzzle, every blog starts from a slightly different corner and came across different blocks. I was strapped in perpetual trying and failing because of this. So I thought I better summarise and share my whole experience, along with the pitfalls while trying to work it out.


The upgrade, in a nutshell, is a process of uninstalling the current version of svn, and download, compile and install the target version.

Prerequisites

CentOS, SVN 1.6


Recipes and Tasting

1. Remove current svn

That's right! You heard me, be brave and remove svn using:
# yum remove subversion

2. Download target version of svn


Go to the following location:
# cd /usr/local/src/

And download the the target version of svn using:
# wget http://apache.mirrors.timporter.net/subversion/subversion-1.7.16.tar.gz

Surely you might come across problem like, you can't download the specific version because it does not exist. Fear not, just go to this mirror, and find the version you want and wget it again.

3. Unzip svn

Unzip the svn using:
# tar zxf subversion-1.7.16.tar.gz 

And navigate into the directory:
# mv subversion-1.7.16 subversion
# cd subversion

4. Download dependencies for svn

There are two packages needed by svn, namely apr and apr-util, before svn can be complied. Download and unzip them in the directory as previously navigated to.

tar zxf apr-1.5.0.tar.gz
tar zxf apr-util-1.5.3.tar.gz

Of course, go to this mirror to find a specific version, or the listed version does not exist anymore.

5. Rename dependencies directory

mv apr-1.5.0 apr
mv apr-util-1.5.3 apr-util

6. Configure svn

By running:

./configure

6.1 Oops, you might be missing sqlite dependency

The steps have been straight forward so far, yet configure may fail because of the following reason:

configure: checking sqlite library
checking sqlite amalgamation... no
checking sqlite3.h usability... no
checking sqlite3.h presence... no
checking for sqlite3.h... no
checking sqlite library version (via pkg-config)... no

An appropriate version of sqlite could not be found.  We recommmend
3.7.6.3, but require at least 3.6.18.
Please either install a newer sqlite on this system

or

get the sqlite 3.7.6.3 amalgamation from:
unpack the archive using tar/gunzip and copy sqlite3.c from the
resulting directory to:
/usr/local/src/subversion-1.7.14/sqlite-amalgamation/sqlite3.c

configure: error: Subversion requires SQLite

Now have a look at the sqlite version:

# sqlite3 -version

Mine comes up as '3.3.6', which is well out of date apparently. If you are sure you've got the correct version, try ./configure again, on success go to 7, otherwise jump to 6.2.

Now the sqlite has to be downloaded and upgraded:

yum --enablerepo=atomic upgrade sqlite

Even though this step does work quite well for me, keep on trying to find the correct package if the link let you down. And check the sqlite version again, 3.7.0.1, it says. Hooray.

6.2 Yet another Oops, you might need to get sqlite dependency manually

Sometimes, even if everything seems to be correct, it just won't work. Just like my case, which I have got the correct version of sqlite, ./configure just decided not to work! That leaves me the second option: to get the sqlite files manually, and put it in the specific directory just for svn configuration's sake:

unzip sqlite-amalgamation-3080200.zip
mv sqlite-amalgamation-3080200 sqlite-amalgamation

7. Compile and install svn

Until now, ./configure should run smoothly. Otherwise, I seriously have no idea what you are up against, so go cry for help elsewhere!

It is then a matter of compiling and installing it:

make
make install

Hmm, might as well go grab a cup of tea while waiting for it to compile. What's worse that could happen right :D

8. Check svn version and happy upgrading the project

cd <project directory>
svn upgrade

9. Certificate

If unfortunately, the svn server uses HTTP/HTTPS protocol, a specific module 'serf' has to be added to svn, and possibly a P12 certificate has to be assigned (for HTTPS).

The 'serf' can be downloaded from: 

# wget http://serf.googlecode.com/files/serf-1.2.1.zip

Unzip and move it to the default folder, and reinstall the project:

# unzip serf-1.2.1.zip
# mv serf-1.2.1 serf

Alternatively, specify it when reconfiguring subversion project:

# ./configure --with-serf=/usr/local/src/subversion/serf
# make
# make install

Even more annoyingly, the certificate needs to be configured in:

# cd ~/.subversion/
# vim servers

with the following information attached to the end of the file:

ssl-client-cert-file = <P12 unc>
ssl-client-cert-password = <***>

And that's given you have been given the details by your sysadmin. Therefore, I call it 'unfortunate', and I should follow it up once I manage to crack that part of the world :D

Reference:

No comments:

Post a Comment