Here is my documentation on setting up WebSVN on VisualSVN on a Windows Server. Two years ago Sebastiaan and I (but mainly Sebastiaan) set up VisualSVN and installed WebSVN on top of it to browse VisualSVN’s repositories via a web interface. Now I needed to install all the latest versions on a new server and document it. I ran into some trouble because my notes were out of date and Google didn’t help me very much so once the documentation was completed I decided to put it online so it might be use to you.

I am not an expert on any of the software described here. A Troubleshooting section on the bottom of this page lists a couple of errors I encountered while installing and tips on what to do with them.

This guide was originally intended for a colleague who would be installing it. The task was to create a complete installation guide leaving nothing out. You can probably skip most of it however I like to be overcomplete rather than leave steps out that may be obvious to me but might mystify someone else.

The plan

The installation of VisualSVN with WebSVN consists of six parts:

  • VisualSVN Server hosts your code base
  • Cygwin for tools such as diff and zip
  • PHP
  • WebSVN for browsing repositories
  • Testing
  • Troubleshooting

 
 
This article does not cover:

  • installing Virtualbox
  • installing Windows
  • setting up certificates
  • connecting SVN clients to your SVN server

Versions

This guide is based on:

Before you begin, download all necessary software.

VisualSVN Server

  1. Execute VisualSVN-Server-2.7.2.msi.

    svn-01
  2. The VisualSVN Server 2.7.2 Setup Wizard is opened. Click Next.
    svn-02
  3. Read the End-User License Agreement, tick I accept te terms in the License Agreement and Click Next.
    svn-03
  4. Select VisualSVN Server and Management Console and tick Add Subversion command-line tools to the PATH environment variable. Click Next.
    svn-04
  5. Click Standard Edition.
    svn-05
  6. Fill in these values:

    Location: C:\Program Files (x86)\VisualSVN Server\
    Repositories: C:\Repositories\
    Server Port: 443
    [x] Use secure connection (https://)

    Click Next
    svn-06

  7. Click Install and wait for the installation to finish.
    svn-07
  8. Uncheck Subscribe for release notitication via email or RSS and check Start VisualSVN Server Manager. Click Finish.
    svn-08
  9. The VisualSVN Server management console is opened.
    In the tree view on the left, right-click VisualSV Server (Local) and choose Properties.
    svn-09
  10. The VisualSVN Server Properties dialog box is opened. Go to the Authentication tab, choose Use Windows authentication, check Basic authentication and click Ok.
    svn-10
  11. The service is restarted. Verify that the server is reachable by opening your browser and navigating to https://localhost. Ignore the ssl error for now and log on with a local user account.
    svn-11
  12. If all is well you’ll get no errors and the VisualSVN Server page is displayed.
    svn-12

    You can now close the VisualSVN Server management console and your browser.
  13. Cygwin

  14. Run setup-x86_64.exe.
    svn-50
  15. Click Next.
    svn-51
  16. Select Install from Internet and click Next.

    Is it possible to download the files you need. Cygwin would save these files to a local directory. You could then move the directory to a computer on which you want to install Cygwin offline and point to it as the local repository (Install from Local Directory). Assuming you have a working internet connection on the machine you’re installing on now however select Install from Internet.
    svn-52

  17. Stick to the default Root Directory for the screenshots in this article to stay consistent or choose another one. Select All Users (RECOMMENDED). I didn’t test the Just Me option so I can’t really say anything about that; I just know the All Users option worked for me. Click Next.
    svn-53
  18. Select the location for the downloaded files and click Next. You can delete this directory after installation or you can keep it around for another time. If you want to keep it, you may want to select a different directory. For the installation at hand it doesn’t matter where you store the files.
    svn-54
  19. Select your internet connection type and click Next.
    svn-55
  20. Select a mirror near you and click Next.
    svn-56
  21. Search for diff. Expand to All > Utils and find the line where it says diffutils: A GNU collection of diff utilities.

    Do NOT click Next yet.
    svn-57

  22. On the line where it says diffutils: A GNU collection of diff utilities, click the word Skip, changing it to the highest version you can find. This will automatically check the Bin box. No need to check the Src box.

    Do NOT click Next yet.
    svn-58

  23. Repeat for these tools and do NOT click Next between searches. Your installation choices will remain marked between searches. Give preference to the highest versions if more are available. Install the binaries (Bin column), not the sources (Src column).

    • diff (Category: Utils. We just did that one.)
    • enscript (Category: Text)
    • sed (Category: Base, probably marked for installation by default)
    • tar (Category: Base, probably marked for installation by default)
    • gzip (Category: Base, probably marked for installation by default)
    • zip (Category: Archive, be careful to really choose zip and not bzip2 for example. There are a lot of utilities that look like zip but aren’t.)
    • unzip (Category: Archive)

    svn-59

  24. Click Next. Cygwin Setup will ask you if you want to resolve dependencies. Make sure Select required packages (RECOMMENDED) is checked and click Next/.
    svn-60
  25. Cygwin is now downloaded and installed.
    svn-61
  26. Choose where you want your icons and click Finish.
    svn-62
  27. PHP

  28. Create a directory C:\php and extract the contents of the file php-5.4.22-Win32-VC9-x86.zip to it.
  29. Copy C:\php\php.ini-production to C:\php\php.ini.
    svn-31
  30. Open the file C:\php\php.ini and make the following changes:

    ;extension=php_fileinfo.dll --> extension=php_fileinfo.dll
    ;extension=php_mbstring.dll --> extension=php_mbstring.dll
    ;extension=php_xsl.dll --> extension=php_xsl.dll

  31. In the Dynamic Extensions section, add this line:

    extension=php5apache2_2.dll

    svn-33

  32. Open C:\Program Files (x86)\VisualSVN Server\conf\httpd-custom.conf and enter this text:

    PHPIniDir "C:\PHP\"
    LoadModule php5_module "C:\PHP\php5apache2_2.dll"
    AddHandler php5-script .php
    
      DirectoryIndex index.php
      Options FollowSymLinks 
      AuthName "WebSVN"
      AuthType VisualSVN
      AuthzVisualSVNGlobalAccessFile "C:/Repositories/Vis
                               ualSVN-GlobalWinAuthz.ini"
      AuthnVisualSVNBasic on
      AuthnVisualSVNIntegrated off
      AuthnVisualSVNUPN Off
    

    Note: the line beginning with AuthzVisualSVNGlobalAccessFile must be one line; it ends in .ini”.
    svn-34

  33. Add C:\php to the system path: click Start, right-click Computer, choose Properties. This will open the System window. Click Advanced system settings. In the System Properties window, open the Advanced tab. Click the Environment Variables button. This will open the Environment Variables window. Under System variables select the Path variable and click Edit. This will open the Edit System Variable dialog window. Add ;C:\php to the value and click Ok, Ok, Ok.
    svn-35
  34. WebSVN

  35. Create a folder C:\Program Files (x86)\VisualSVN Server\htdocs\WebSVN and extract the contents of the file websvn-2.3.3.zip\websvn-2.3.3 to it (so leave out the folder inside the zipfile; extract the files that are in that folder).

    svn-39
  36. Copy the file C:\Program Files (x86)\VisualSVN Server\htdocs\WebSVN\include\distconfig.php to C:\Program Files (x86)\VisualSVN Server\htdocs\WebSVN\include\config.php.
    svn-40
  37. Open the file C:\Program Files (x86)\VisualSVN Server\htdocs\WebSVN\include\config.php and add the following lines to it:

    $config->setSVNCommandPath('C:\\Program Files (x
                          86)\\VisualSVN Server\\bin');
    $config->setDiffPath('C:\\cygwin64\bin');
    $config->setEnscriptPath('C:\\cygwin64\bin');
    $config->setSedPath('C:\\cygwin64\bin');
    $config->setTarPath('C:\\cygwin64\bin');
    $config->setGZipPath('C:\\cygwin64\bin');
    $config->setZipPath('C:\\cygwin64\bin');
    $config->parentPath('c:\\repositories');

    Note that the first line (containing setSVNCommandPath) must not contain a line break although in this article it may.
    svn-41

  38. Testing

  39. From the Start Menu choose VisualSVN Server Manager. Right-click on Repositories and choose New > Repository. In the Repository Name field, enter Test. Click Next.
    svn-42
  40. Choose Empty repository (recommended option) and click Next.
    svn-43
  41. Choose Explicit Read / Write access for the current user ([SERVERNAME]\Administrator) and click Create.
    svn-44
  42. Click Finish.
    svn-45
  43. Open Internet Explorer and navigate to https://localhost/websvn. Ignore the security certificate warning for now.
    svn-46
  44. Click Continue to this website (not recommended). The WebSVN repository browser should come up.
    svn-47

Troubleshooting

The most difficult part of getting WebSVN running on top of VisualSVN was getting PHP to play nice with Apache. VisualSVN Server comes with Apache and Apache in VisualSVN Server isn’t necessarily the most recent Apache version around. The VisualSVN website advertises the Apache version used in the VisualSVN Server version you’re installing.

If the VisualSVN Server process cannot be started, check Windows Event Viewer. It will list the exact error Apache spits out.

An error stating that Apache can’t run ‘side-by-side’ tends to mean the .NET Framework isn’t (correctly) installed. This shouldn’t be a problem on an up-to-date machine.

An error stating that a module can’t be found does not necessarily mean the module (in most cases php5apache2_2.dll) can’t be found! While it might mean that it may also mean php5apache2_2.dll is not the correct version. Be very careful to download the correct php version for Apache used in VisualSVN server. The versions I used for this article work together but since I am not really from the future I can’t say for certain they are the latest versions when you are reading this.

Installing the Microsoft Visual C++ Redistributale is not necessary to troubleshoot the above errors, contrary to what most forums would like you to believe. It may not harm your server but I didn’t install it and VisualSVN Server and WebSVN run just fine.