Monday, September 5, 2005

Subversion and TortoiseSVN Installation Cookbook

After reading several good things regarding Subversion and TortoiseSVN I decided to give it a try. The “final straw” came while looking into Ajax.NET which is housed in SVN and required installing TortoiseSVN to obtain the source. The process was so smooth and easy I decided it was worth a shot. The scm options facing my little company are very typical:

  1. Continue using VSS with it's warts - extremely slow client, requires either VPN access to servers in office or a 3rd party product such as SourceOffsite to make remote access feasible, etc.
  2. Purchase another solution such as Vault.
  3. Migrate to Team Foundation Server - not only is the new pricing model a “step-up“ for small ISVs but there's hidden costs as well. It requires 3-tier deployment, must install/use Active Directory, requires SQL Server 2005. Can I really afford to update memory, buy licenses, and dedicate at least three servers for what used to take just one?
  4. Try something else such as Subversion.

I decided to try door #4. Below is a quick “cookbook” style approach of what it took to get it up and running. Following that are a variety of links that I found.

  1. Install Apache 2 (2.0.54):
    1. Change httpd.conf to use non-default port (Listen 81 or Listen 8080).
    2. Create Windows user account ApacheUser.
    3. Grant ApacheUser modify rights to C:\Program Files\Apache Group\Apache2\logs
    4. Change Apache service to run as ApacheUser and restart.
  2. Install Subversion (1.2.1):
    1. Run Subversion installer.
    2. Modify httpd.conf to add /svn virtual root (see TortoiseSVN docs - 3.1.4)
    3. Create svn root directory somewhere (e.g. F:\svn). Note the multiple warnings that you should NOT use the Berkley DB repository format for network shares (including UNC names, mapped drives, etc.).
    4. Grant ApacheUser full control rights to svn root directory (e.g. F:\svn).
    5. Create Apache passwd file and add users (can optionally configure for SSPI to Windows domain - see TortoiseSVN docs).
      1. bin\htpasswd -c passwd
      2. bin\htpasswd passwd
    6. Restart Apache and test (http://localhost:81/svn/repos)
  3. Install TortoiseSVN (1.2.2.4299 VS.NET - ASP.NET version) which is an excellent Windows shell extension for using SVN.
    1. Re-boot to get shell extension icons working.
    2. Right-click on repository (e.g. F:\svn\repos) and Create Repository...
  4. Install AnkhSVN (0.5.5.1653) for VS.NET integration.
    Edit \Application Data\AnkhSVN\ankhsvn.xml - uncomment
              <AdminDirectoryName>_svn</AdminDirectoryName>
           to match TortoiseSVN patch for ASP.NET files.
  5. Final note for properly backing up the repository:
    svnadmin hotcopy path/to/repository path/to/backup --clean-logs

Here's a list of links I found very helpful in addition to both the Subversion documentation and especially the TortoiseSVN documents (since it is a Windows client).

Cory Foy, Getting Subversion running with .NET
Michael Flanakin,  Subversion and Windows Authentication with Subversion on Windows
Jonathan Malek, NAnt, Subversion and VS.NET
Fritz Onion, ASP.NET Application without Web Projects ** It seems a lot of folks like this one however I did not take this route - instead I used the “patched” version of TortoiseSVN which uses “_svn” instead of “.svn” for local admin directories.

One interesting piece of information I found was buried in the replies of this post. Specifically, “The important thing to note is: The initial copy you used to import is not a checked out copy. It cannot be used to work with subversion. You need to check out your own copy. (Even though you already have all the files)”.

Original post