Arthur's Bit Bucket

Sunday, July 31, 2005

Adventures in building Subversion 1.2.1 on Mandriva Linux

I wanted to install Subversion on my Mandriva Linux 2005 LE distribution, but the distro has only version 1.1.4 packaged and I wanted the current version (1.2.1). I decided to build it from the source tarball.

I decided to use Apache instead of svnserve. I installed the following packages from the distro:

  • apache2

  • apache2-devel (I'm not sure if this is explicitly needed but I installed it anyway)

  • apache2-mod_dav


When I first ran Subversion's configure script, it skipped building mod_dav_svn, the module needed for Subversion to work via Apache. To get it to include mod_dav_svn, I did the following:

./configure --with-apxs=/usr/sbin/apxs2
make
make install (after issuing su)

After this, Apache wouldn't start--it was reporting an error about some missing symbols I believe (I don't recall the exact error message). The problem was that the Apache module mod_dav.so has to be loaded before mod_dav_svn.so and mod_authz_svn.so modules. I edited /etc/httpd/conf/httpd2.conf and added the following line just above the two LoadModule commands the Subversion install inserted to load mod_dav_svn.so and mod_authz_svn.so:

LoadModule dav_module modules/mod_dav.so

Then, I needed a Location section in httpd2.conf for Subversion. I set up basic authentication with a specific user list. I also wanted my Subversion virtual root to be /svn (i.e. http://server/svn), and to have all repositories I created to follow this URL (e.g. http://server/svn/repo1, http://server/svn/repo2). The section, placed at the very bottom of httpd2.conf, looks like the following:

<Location /svn>
  DAV svn
  SVNParentPath /home/svn
  Require valid-user
  AuthType Basic
  AuthName "Subversion repositories"
  AuthUserFile /home/svnpasswd
</Location>

That was it for httpd2.conf. Then I needed to add a user to the authorized user file. I did this with htpasswd:

htpasswd /home/svnpasswd myusername

Next I needed to fix the permissions on the repository root I chose, /home/svn. The way I got this to work was to make apache the owner and users the group, and give both read/write access. Note the -R for recursive to apply to the repository subfolders I created:

chown -R /home/svn apache
chgrp -R /home/svn users
chmod -R +rw /home/svn

Lastly, I needed to configure msec so it doesn't come along and wipe out the permissions and ownership I changed on /home/svn. I edited /etc/security/msec/perm.local and added the following lines:

/home/svn current 770
/home/svn* current 770

Happy Subversioning!