Subversion Cheat Sheet
Installing Subversion on a Windows Server
Subversion is a great source code control system. It is fast, reliable, and provides great flexibility on the files and directories which it can manage, including the ability to allow control via HTTP. So after having installed the Apache HTTP Server in order to allow the Subversion server to host files via HTTP, proceed as follows to install and configure Subversion.
Environment
Windows Server 2008 R2.
Apache HTTP Server 2.2.11.
CollabNet Subversion Server 1.5.6-2.
Prerequisite Information
Before installing Subversion, gather the following information:
The port number that Subversion should listen on: 3690
The main Subversion repository path: c:\svn
The Apache host name: localhost
The Apache port number: 81
The repository path for mod_dav_svn: c:\svn
The repository URL prefix: /svn
Installation
Download the installer program and run it.
In the Welcome screen, click the Next button.
In the Readme screen, click the Next button.
In the Choose Components window, be sure that SVNSERVE and Apache (MOD_DAV_SVN) are selected, then click the Next button.
In the Configuration window, enter the port number and main repository path. Also make sure the Install svnserve to run as Windows service option is selected. Then click the Next button.
In the Apache Configuration window, enter the requested information. Be sure that the Install Apache to run as a Windows service option is selected. Then click the Next button.
In the Install Location window, specify where Subversion should be installed, then click the Install button.
Click the Finish button.
Post-Installation Tasks
Ensure that Subversion is installed properly with this command:
svn --version
Add the Subversion port to the Windows Firewall.
Run Windows Firewall (Start → Control Panel → Windows Firewall).
Click the Allow a program or feature through Windows Firewall link.
Click the Allow another program button.
In the Add a Program window, click the Browse button and locate the Subversion executable, usually located here:
C:\Program Files (x86)\CollabNet\Subversion Server\svnserve.exe
In the Add a Program window, click the Add button.
Subversion Server should now be listed in the exceptions list of allowed programs and have a check-mark next to its name. Click the OK button in this window.
The Subversion server distributed by the CollabNet people has the Apache HTTP server bundled into it (and is now installed on your system if you followed the directions above). I have read their rationale for doing this but do not agree that a separate copy of Apache is necessary (desireable) to run Subversion so here’s the steps to now undo the Apache server installation performed by their installer and hook Subversion into your already installed Apache server.
Go to the Apache modules directory installed by the Subversion server, typically here:
C:\Program Files (x86)\CollabNet\Subversion Server\httpd\modules
The two Subversion modules named mod_authz_svn.so and mod_dav_svn.so should be copied to the standard Apache modules directory, typically located here:
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\modules
Open the standard Apache httpd.conf file with a text editor, which is usually located here:
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf
Add the following lines to the end of the file (if they are not already there):
<Location /svn/>
DAV svn
SVNParentPath C:\repositories
SVNListParentPath On
Require valid-user
AuthType Basic
AuthName "Subversion repository"
AuthUserFile bin/svn-passwd
</Location>
Be sure to change the SVNParentPath and AuthUserFile entries to point to your repository directory and also be sure that the location is set to /svn/ and not just /svn (note the trailing slash).
Check and make sure that the following LoadModule lines are uncommented (do not begin with a # character):
LoadModule dav_module modules/mod_dav.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule proxy_module modules/mod_proxy.so
If it is not already there, add the following line to the end of the LoadModule section:
LoadModule dav_svn_module modules/mod_dav_svn.so
Rename the httpd directory from step 1 to something like httpd-do-not-use.
If you do not already have a password file set up for your Subversion users then create one now. Change your directory to the the Apache bin directory:
cd/d C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin
Then enter this command to create the user jsmith:
htpasswd -c svn-passwd jsmith
and type in the password for user jsmith when prompted. If you already have a password file and would just like to add another user to it (or change an existing user’s password) use this command instead:
htpasswd svn-passwd jsmith
Configuration
Create the Subversion repository.
Set your default directory to the parent directory which you would like to create your repository in. For example, if your repository will be in the directory c:\svn then use this command:
cd/d c:\
Use the svnadmin command to create the repository directory. For example:
svnadmin create svn
Note: The last parameter (svn, in this example) should be the name you wish to give to the repository (i.e., the subdirectory of your current directory).
A password file for the repository is created in the conf subdirectory of the repository’s directory. For example:
c:\svn\conf\passwd
Edit the password file with a text editor and add user accounts and passwords. For example, to add the user smith with a password of jones add this line to the end of the file:
smith = jones
Also in the conf directory, edit the file svnserve.conf and uncomment the following line:
# password-db = passwd
Start the Subversion Server service.
Start the service control manager (Start → Administrative Tools → Services).
Locate the entry named CollabNet Subversion svnserve, right-click on the name, and select Start.
Next Steps
Install TortoiseSVN. (Use _svn for directories.)