Set Up HTTP Access
The first thing we need to do is make sure that Apache loads the WebDav modules. The Apache config file (httpd.conf) is located in the C:\Program Files\Apache Group\Apache2\ conf directory. Launch a text editor, and open the Apache config file. You will want to keep this file open for the rest of the installation.
Copy the Subversion HTTP module (Program Files\Subversion\bin\mod_dav_svn.so) into the Apache modules directory (Program Files\Apache Group\Apache2\Modules).
In the config file, look for a section of lines that all start with LoadModule. At the end of that section, add the following lines:
LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so
At this point, restart the Apache2 service (Control Panel > Administrative Tools > Services). You will probably want to keep the Services window open (we will be restarting Apache several more times). If it restarts with no errors, Apache is now loading the SVN module.
Back in the Apache config file, add the following to the end of the file:
<Location /repos>
DAV svn
SVNPath "C:\svnrepos"
</Location>
Restart Apache2 again, and if it restarts successfully, go ahead and pat yourself on the back. You can now access your repository via HTTP (that wasn’t so bad, was it?)
Configuring Authentication
One small note before we start looking at authorization. There are several different ways you can configure authorization for Subversion, but I am only going to show you basic authorization in this guide. Basic authorization sends the passwords in near plain-text, so if you are concerned with password snooping, you will want to use a different authorization scheme.
At this point, we can browse our repository via HTTP. Not only that, but we can also check-out, modify, and commit changes. However, none of these operations require any type of authorization. Not exactly what we want, especially if we are going to have multiple users.
To enable authorization, we need to tell Apache who the authorized users are. To do this, we give Apache a file with a list of the authorized users and their passwords. Apache makes this job easy by providing a utility to mange the user file, htpasswd.
Let’s go ahead and create our user file with the users Alice and Bob. We are going to put our file in the Apache conf directory, so open a command prompt to that directory (Program Files\Apache Group\Apache2\conf). Type the following command, and then enter a password for Alice.
C:\Program Files\Apache Group\Apache2\bin\htpasswd -cm svn-auth-file Alice
Now type in the following command to add Bob to the file.
C:\Program Files\Apache Group\Apache2\bin\htpasswd -m svn-auth-file Bob
Notice the difference between these two commands. The first command passes in the -c command, which tells htpasswd to create the file. The second time, the file already exists, so we don’t want it to be re-created. The second command is what you would use to add additional users to the file. If you look at the svn-auth-file, you will see entries for both Alice and Bob.
Now that we have our authorization file, we need to tell Apache where to look for it. Go back to the Location tag that we added to the Apache config file. We need to add some more lines to it so that it looks like this
<Location /repos>
DAV svn
SVNPath "C:\svnrepos"
AuthType Basic
AuthName "Subversion repository"
AuthUserFile "C:\Program Files\Apache Group\Apache2\conf\svn-auth-file"
Require valid-user
</Location>
After restarting Apache2 once again, browse to your repository again. This time, you will be prompted for a user name and password. Cool, we have authorization working. However, I don’t want to be prompted for a user name unless modifying the repository, so we’re not quite finished yet.
Thankfully, only requiring authorization for modifications is really easy. All we have to do is add a couple more lines to our location tag so that it looks like this
<Location /repos>
DAV svn
SVNPath "C:\svnrepos"
AuthType Basic
AuthName "Subversion repository"
AuthUserFile "C:\Program Files\Apache Group\Apache2\conf\svn-auth-file"
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
One last restart of Apache, and we now have the Subversion HTTP module installed, configured, and ready to control our revisions.