Setting up Subversion 1.4 with Apache 2
Posted by Max Dunn Tue, 23 Jan 2007 17:50:00 GMT
I like Linux, I really do. That is one reason why I got a Mac last year and also why I host my web sites on Linux servers. However, for all the talk about Microsoft’s DLL Hell, it is nothing compared to Linux Dependency Version Hell. Those of you that have tried installing new versions of software on Linux know what I mean. Whenever you upgrade one piece it causes a cascading effect of having to upgrade lots of other pieces. And sometimes there is a problem with the latest version of a library so you have to use an older version. Now if you have something like apt-get, yum or urpmi, it can help a lot by installing all the needed dependencies for you. But once you venture outside the official versions, it will take a long time to get everything right.
Take for instance, what should be a straightforward task of getting Subversion 1.4 (SVN) working with Apache 2. Of course, you don’t have to have these working together because you can use svnserve by itself. But this only lets you set access control for the whole repository, rather than the finer grained access you get going through http, and you also need to add all svn users to Linux, which is problematic. So to get the advantage of having Subversion working through Apache using http, I spent a day figuring it out.
In the end, the procedure turned out to be fairly straightforward and to save others the pain I went through, here is the trick:
Use the Apache apr and apr-util libraries when making Subversion.
On a standard install, you will probably have libapr-1.so and libaprutil-1.so in both /usr/local/apache2/lib and /usr/local/apr/lib and maybe even /usr/lib. If you configure Subversion with the defaults, it will find the apr libraries in /usr/lib. And if they are not the exact same version as in /usr/local/apache2/lib, there won’t be any errors but when you try to access the repository, you will get error messages like:
Could not fetch resource information. [500, #0]
Could not open the requested SVN filesystem [500, #2]
Internal error: Can't open file '/var/svn/format': No such file or directory
So the best thing is to delete all the libapr* files everywhere but /usr/local/apache2/lib and then configure Subversion like this:
./configure --with-apxs=/usr/local/apache2/bin/apxs \
--with-apr=/usr/local/apache2/bin/apr-1-config \
--with-apr-util=/usr/local/apache2/bin/apu-1-config
After that, you should be able to follow the Subversion/Apache setup instructions with no problems.