Tuesday, July 24, 2007

How to Setup a Subversion Server on Windows

A while back I wrote an How To on how to setup a Subversion server on Linux. So anything you can do on Linux you should be able to do on Windows, right? Well I am not getting into that debate, but yes you can setup a Subversion server on Windows. Much like Linux there are many ways to accomplish this, today I will be talking about how to set it up using Apache. So let's take a look...
Downloads:
These are the recent versions of this date, please check for the latest stable versions at time of install.
apache_2.2.4-win32-x86-no_ssl.msi
svn-1.4.4-setup.exe
TortoiseSVN-1.4.4.9706-win32-svn-1.4.4.msi
Install:
First lets install Apache. You should be able to select all of the defaults during the installation process, unless you know what you are specifically trying to accomplish. Be sure to select "Apache Modules" where it talks about the SVN module.
Second lets install SVN, again the defaults work fine.
Third, and last install TortoiseSVN, yup defaults work good for this as well.
Configure Apache Password File:
First lets create a Apache password file, from a command line run:
C:\Program Files\Apache Group\Apache2\bin\htpasswd.exe -c C:\Program Files\Apache Group\Apache2\passwd myuser
Be sure to replace "myuser" with the username you wish to use for your login.
Create a Repository:
Next we need to create a subversion repository:
C:\Program Files\Subversion\bin\svnadmin.exe create C:\MyRepos

Configure Apache:
In Notepad open up the file "C:\Program Files\Apache Group\Apache2\conf\httpd.conf" and put the following at the end of the file:

DAV svnSVNPath "C:\MyRepos"AuthType BasicAuthName "My Subversion Repository"AuthUserFile passwdRequire valid-user

Presto! All you need to do is restart Apache via the neat little system tray icon, and import your repository and you are up and rolling.