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.
bunzip2 pcre-8.21.tar.bz2 tar xvf pcre-8.21.tar cd pcre-8.21/ sh ./configure --prefix=/usr/local/pcre make make install
tar zxvf zlib-1.2.7.tar.gz cd zlib-1.2.7 sh ./configure --prefix=/usr/local/zlib make make install
tar zxvf libxml2-2.7.2.tar.gz cd libxml2-2.7.2 sh ./configure --prefix=/usr/local/libxml2 make make install
tar zxvf expat-2.1.0.tar.gz cd expat-2.1.0 sh ./configure --prefix=/usr/local/expat make make install
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 make install
tar zxvf apr-1.4.6.tar.gz cd apr-1.4.6 sh ./configure --prefix=/usr/local/apr make make install
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 make install
tar zxvf sqlite-autoconf-3071601.tar.gz cd sqlite-autoconf-3071601 sh ./configure --prefix=/usr/local/sqlite make make install
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 make install
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 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.
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
AuthName “Subversion repository”
Once all this was done, I fired up Apache manually as I had no init script ready yet:
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
/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