Configuring Subversion & Apache2 as installed by DarwinPorts
Once you have Subversion & Apache2 installed, the next step is to configure it. I have been through this exercise before — probably even blogged it. I figured I would document it again with a focus on trying to make the commands copy/paste-able. That, and the next step is try and configure SSL based authentication to the repository.
The first step is to create a Subversion repository and set the ownership:
sudo mkdir /svn sudo svnadmin create --fs-type fsfs /svn/master sudo chown -R www /svn
As I have some scars resulting from corrupt Berkeley DB data stores, I chose to use the filesystem– fsfs– based backing store for Subversion.
The next step is to configure Apache2.
cd /opt/local/apache2/conf/ cp httpd-std.conf httpd.conf
I created a patch file that can be applied to httpd.conf. In order, the chunks of the patch make the following changes:
- Configures Apache2 to listen on port 8000
- Loads the dav_svn_module
- Eliminates the standard document root. When done, the server will only respond to Subversion and icon requests.
- Adds a <Location /svn> block at the end that configures subversion for the previously configured repository located at /svn/master. Requires an authorized user.
At this point, everything is configured. Now it is time to create a user or two. Note that the ‘sudo’ below (or above) may prompt for “Password:”. Keep track of whether you are entering your password or the new user’s password.
cd /svn/ sudo -u www htpasswd -c master-auth <user> New password: Re-type new password: sudo -u www htpasswd <user2> New password: Re-type new password: /opt/local/apache2/bin/apachectl configtest Syntax OK sudo /opt/local/apache2/bin/apachectl restart httpd not running, trying to start
Also, if you have a user or two that you want to add but don’t want to deal with typing their password, have them create an htpasswd file and simply send it to you. The file is of the format “user:hash”. Just append the “user:hash” to the end of master-auth and restart apache.
At this point, visiting the URL http://svnhost:8000/svn/ should reveal an empty Subversion repository at revision 0.
Thanks to Adam Swift for the excellent article on setting up Subversion. Helped a lot.

