Setting up subversion

These are some quick notes on setting up subversion. They are by no means complete, but describe some of the problems I ran into, and how I solved them.

More complete information on subversion can be found at the subversion website. Here is the manual .

I am running Redhat 9 on my laptop, the subversion client, and Fedora Core 1 on my UML colo machine, the subversion server. I suspect things would have gone a LOT more smoothly if I was using debian and apt-get.

FC1 yum loads a really old version of subversion, 0.32 something. Don't use it.

There is a site that provides some rpms and procedures for subversion, summersoft.fay.ar.us . Some folks say that is bogus, that you should be using the 0.94 version of libapr, not this guy's 0.95 . I was having problems with 0.95 and am now using 0.94, because not even htpasswd was working with 0.95 . YMMV.

I ended up downloading the following RPMs for the colo server:

  perl-URI-1.21-7.noarch.rpm
  subversion-1.1.3-0.1.1.fc1.rf.i386.rpm
  apr-0.9.4-2.1.i386.rpm
  apr-util-0.9.4-2.1.i386.rpm
  mod_dav_svn-1.1.3-0.1.1.fc1.rf.i386.rpm
  neon-0.24.5-2.1.i386.rpm

Look in /var/log/rpmpkgs to see what RPMs you have now. After getting these RPMs installed on the server, the next step is setting up subversion on the client machine. I could not find any good binary RPMs for Subversion and RedHat 9, so I built from source. I downloaded subversion-1.1.3-1.src.rpm from the main subversion site, and did the usual ./configure and make and make install (install as root). With RH9, I could not access the Berkeley 4.2 database, so the code built with fsfs only. This is faster and cleaner anyway.

However, because I only had fsfs available, the make check did not work. I traced this to the file subversion/tests/clients/cmdline/svntest/main.py. Change the line (approx line number 114) reading:

# Global variable indicating the FS type for repository creations.
fs_type = "bdb"

to

# Global variable indicating the FS type for repository creations.
fs_type = "fsfs"

The "make check" tests take about 5 minutes on a P-4 2GHz.

After setting up the software, start configuring the server for apache authentication and subversion. /etc/httpd/conf/passwd and /etc/httpd/conf/groups files. You make the passwd file with:

root> cd /etc/httpd/conf
root> htpasswd -cb passwd firstuser firstpasswd
root> htpasswd  -b passwd nextuser  nextpasswd
root> htpasswd  -b passwd thirduser thirdpasswd

After you are done, the passwd file will look something like:

firstuser:kI6H./Us(H4PY
nextuser:ZMzDCs7gqEoM3
thirduser:9/TszW.jPYZxL

The next step is setting up a groups file, by hand with the editor:

svncommit: firstuser seconduser thirduser

Now, create the subversion repository:

svnadmin create --fs-type fsfs /home/svn

Note that the Redhat native static libdb won't work with Subversion, but the subversion fsfs "filesystem" works fine. I have this directory and subfiles chown'ed to apache.apache.

Now, edit the Apache httpd.conf file. Save a copy first, if you screw up your web server won't restart. I added this to the end of the file, after all the sections setting up the virtual hosts:


        DAV svn
        SVNPath /home/svn
        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile  /etc/httpd/conf/passwd
        AuthGroupFile /etc/httpd/conf/groups
        
                Require group svncommit
        

I did not have to add LoadModule lines for dav_svn_module or authz_svn_module. This is a surprise and I still don't understand it. Note that the order of the lines in the above fragment is critical. Earlier, I had the DAV and SVNPath lines after the Auth* lines, and this caused authentication errors that looked like this on the client:

root> svn mkdir http://www.myserver.org/svn/newproject -m 'Create project'

Authentication realm:  Subversion Repository
Password for 'firstuser':
Authentication realm:  Subversion Repository
Username: firstuser
Password for 'firstuser':
Authentication realm:  Subversion Repository
Username: firstuser
Password for 'firstuser':
svn: MKACTIVITY of '/svn/!svn/act/74436339-4e10-0930-acb9-a38e2fadb293': authorization failed (http://www.myserver.org)

And like this in /var/log/httpd/error_log:

[Thu Feb 03 13:04:23 2005] [error] [client 12.34.56.78] user firstuser: authentication failure for "/svn/!svn/act/74436339-4e10-0930-acb9-a38e2fadb293": Password Mismatch
[Thu Feb 03 13:04:28 2005] [error] [client 12.34.56.78] user firstuser: authentication failure for "/svn/!svn/act/74436339-4e10-0930-acb9-a38e2fadb293": Password Mismatch
[Thu Feb 03 13:04:34 2005] [error] [client 12.34.56.78] user firstuser: authentication failure for "/svn/!svn/act/74436339-4e10-0930-acb9-a38e2fadb293": Password Mismatch

Again, getting the order right is important. When you are having problems with subversion and apache authentication, it helps to break the problem up into pieces, and test httpd authentication without subversion. You can do this with a test directory, something like www.myserver.org/test/ with a small index.html file inside. Add this to the end of httpd.conf:


        AuthType Basic
        AuthName "Test Directory"
        AuthUserFile  /etc/httpd/conf/passwd
        AuthGroupFile /etc/httpd/conf/groups
        
                Require group svncommit
        

This avoids mod_dav and subversion, just testing the basic apache authentication modules.

I hope the above information helps. I went through two days of hairpulling and lots of bad software combinations to get here. Hopefully it will go faster for you.

Page last modified Friday, Febuary 4, 2005 at 9:10am