Tag Archives: zlib

Building Subversion and DavSVN on SLES 11 SP2 x86_64 from source

So, the time came where I needed to knock up a quick subversion DavSVN test on a box that was out of support for updates from SuSE, which made it more difficult to grab the rpms,etc that I would need to satisfy my requirements.

This put me in the situation of having to build a few things from source, and I thought it might be helpful to share how I went about it.

Firstly I grabbed all of the source tarballs that I would need using wget.

I borrowed the apache config template from this wiki article, but amended it to compliment my install, as the wiki was geared towards CentOS installations. Theres also some good tips on using Authz to lock your repository down further.

wget http://mirror.catn.com/pub/apache/httpd/httpd-2.4.4.tar.bz2
wget http://mirror.catn.com/pub/apache//apr/apr-1.4.6.tar.gz
wget http://mirror.catn.com/pub/apache//apr/apr-util-1.5.2.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.bz2
wget http://downloads.sourceforge.net/project/libpng/zlib/1.2.7/zlib-1.2.7.tar.gz?r=http%3A%2F%2Fzlib.net%2F&ts=1366113188&use_mirror=kent
wget http://www.webdav.org/neon/neon-0.29.0.tar.gz
wget http://www.sqlite.org/2013/sqlite-autoconf-3071601.tar.gz
wget http://mirror.rmg.io/apache/subversion/subversion-1.7.9.tar.bz2
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.2.tar.gz
wget http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz/download

Build PCRE

bunzip2 pcre-8.21.tar.bz2
tar xvf pcre-8.21.tar
cd pcre-8.21/
sh ./configure --prefix=/usr/local/pcre
make install

Build Zlib

tar zxvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
sh ./configure --prefix=/usr/local/zlib
make install

Build LibXML2

tar zxvf libxml2-2.7.2.tar.gz
cd libxml2-2.7.2
sh ./configure --prefix=/usr/local/libxml2
make install

Build expat

tar zxvf expat-2.1.0.tar.gz
cd expat-2.1.0
sh ./configure --prefix=/usr/local/expat
make install

Build Neon

tar zxvf neon-0.29.0.tar.gz
cd neon-0.29.0
sh ./configure --prefix=/usr/local/neon --enable-shared --with-libs=/usr/local/libxml2 --with-expat --with-libs=/usr/local/expat --with-zlib=/usr/local/zlib
make install

Build APR

tar zxvf apr-1.4.6.tar.gz
cd apr-1.4.6
sh ./configure --prefix=/usr/local/apr
make install

Build APR-Util

tar zxvf apr-util-1.5.2.tar.gz
cd apr-util-1.5.2
sh ./configure --with-apr=/usr/local/apr --prefix=/usr/local/apr-util
make install

Build SQLite

tar zxvf sqlite-autoconf-3071601.tar.gz
cd sqlite-autoconf-3071601
sh ./configure --prefix=/usr/local/sqlite
make install

Build Apache

bunzip2 httpd-2.4.4.tar.bz2
tar xvf httpd-2.4.4.tar
cd httpd-2.4.4
sh ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-so --enable-module-dav
make install

Build Subversion

bunzip2 subversion-1.7.9.tar.bz2
tar xvf subversion-1.7.9.tar
cd subversion-1.7.9
sh ./configure --prefix=/usr/local/subversion --with-apxs=/usr/local/apache/bin/apxs --with-apr-util=/usr/local/apr-util --with-neon=/usr/local/neon --with-sqlite=/usr/local/sqlite --with-zlib=/usr/local/zlib/ --enable-shared
make install

Now make the necessary changes to your apache config to give web based access to SVN. You can obviously tailor this more to your requirements, but for my test I changed to my apache installation directory.

cd /usr/local/apache

Then I edited /usr/local/apache/conf/httpd.conf and made the following amendments:

LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so

<IfModule dav_svn_module>
#<IfModule authz_svn_module>
<Location /repos>
DAV svn
SVNParentPath /usr/local/apache/svn
SVNListParentPath on
AuthType Basic
AuthName “Subversion repository”
AuthUserFile /etc/svn-auth-conf
Require valid-user

Once all this was done, I fired up Apache manually as I had no init script ready yet:

/usr/local/apache/bin/./apachectl start

Next I ran htpasswd to create give basic password protection to the repository shown in apache

/usr/local/apache/bin/./htpasswd -c /etc/svn-auth-conf <myuser>

However, for some reason just doing this gives an authentication failure, even if you are entering a valid password,etc. This will result in the password dialog box, disappearing and reappearing every time you try to do an entry.

If you check in your logs you will see an entry similar to this:

[auth_basic:error] [pid 31740:tid 140394130585344] [client xxx.xxx.xxx.xxx:50135] AH01617: user my_user: authentication failure for “/repos/”: Password Mismatch

If you google for the AH01617 you will see that there are various bug reports for this issue, one guy issued a:

/usr/local/apache/bin/./htpasswd -b /etc/svn-auth-conf my_user <passwd>

After the initial user creation and this seems to fix the issue.

However, because we have built this on x86_64 there is a problem with the way that subversion tries to use zlib. If you don’t do the step below you will find that every time you commit a version, the version number will increase, but you will never be able to successfully do a version rollback, as you will see a message along the lines of ‘no version information available ‘.  – You can test what libraries Subversion is linked to by running ‘ldd /usr/local/subversion/bin/svn’.

So what needs doing is to unlink the existing Zlib version in /lib64 and point it to the version that you built earlier on.

I removed my /lib64/libz.so.1, but left the original file that that was pointing to /lib64/ libz.so.1.x.x just in case I need it again.

Next I made a symbolic link from /usr/local/zlib/lib/libz.so.1.2.7 to /lib64/libz.so.1

ln -s /usr/local/zlib/lib/libz.so.1.2.7 /lib64/libz.so.1

Next I created and chmoded my repo folder (only if in a test environment, as this isnt secure)

chmod -R 777 /usr/local/apache/svn
cd /usr/local/apache/svn
/usr/local/subversion/bin/svnadmin create repos

Next you should be able to follow the normal svn commands to import,checkout,add, commit,etc.

Create a few files and you should be able to see files in your repository via http!

(c) Matt Palmer 17/04/2013

[amazon asin=0596510330&template=iframe image&chan=default][amazon asin=0596518889&template=iframe image&chan=default][amazon asin=0470275871&template=iframe image&chan=default]