Setting up subversion on Windows

svn logoToday I had something to test that required a svn repository. Since my home repository wasn’t answering my calls (well, pings actually) I decided to do a quick install of the svn server on my Windows XP box. From what I remembered it should have been simple enough.

After restarting all the process at one point, because I hadn’t paid attention to the warning about Apache 2.2, I found my Apache 2.0 refused to load the dav_svn module and couldn’t figure out why. A quick search on Google revealed the cause, but it still was annoying. So I’ll add here the steps it takes to get a functional, svn server on a Win XP box:

  • Download and install Apache 2.0 or 2.2 (I worked on 2.0) from their website.
  • Download subversion. I’ve picked the latest version, zip format.
  • Download and install Tortoise SVN. It’s the easiest to use client ever.
  • Unpack the downloaded zip to a folder of choice – I used c:/work/tools/svn
  • Create a folder to use as your repository root – again, I used something like this: c:/work/repositories/personal. Inside the repositories/ folder I also keep checked-out copies of the projects that interest me.
  • Open Total Commander /Windows Explorer and go to the folder you picked as repository root. Right Click on it and select TortoiseSVN > Create repository here. Use the native FS.
  • Rigt now, most guides say you’re set up. Actually you’re not – who wants to install a SVN server to use from their machine only? So let’s go on.
  • Browse to the folder where you unzipped subversion. Inside the /bin/ folder there are two .so files. You need to copy them to your apache’s /modules folder (under the installation path).
  • Also copy all of the .dll’s from this folder into apache’s /bin/ folder. This step is often omitted in documentation.
    • Open the httpd.conf file – this is the Apache’s configuration. Locate the LoadModule section and add the following lines:LoadModule dav_module modules/
      LoadModule dav_svn_module modules/
      LoadModule authz_svn_module modules/
    • Next add in the same file some lines that will define how you will access the repository:
    • # Configure Subversion repository
      <Location /svn>
      DAV svn
      SVNPath “c:/work/repositories/personal”
      AuthType Basic
      AuthName “Subversion repository”
      AuthUserFile “c:svn_confpasswd”
      Require valid-user

  • Save the file and close it.
  • Notice that I’ve used something new in these lines – the svn_conf/passwd. This is because I chose to use basic authentication to restrict access for some users, and this is the file that will store the user names and passwords. To add a new user and password, the htpasswd utility from Apache is used, like this:htpasswd -c C:svn_confpasswd desire_name_here
  • You will then be prompted for the password.
  • Now restart Apache and you should be all set. Try browsing to http://localhost/svn and it will ask for a password – the one you’ve set earlier. Then it will display revision 0 of the trunk.

Now you can go ahead and import your own files into the repository and start collaborating.

Later edit : Since I am as always in a rush, I had forgotten to add links to download some of the tools.



, ,