Installing SVN over Apache Server

  • Contents
    • Required Software
    • Terminology
    • Installation steps
    • Common problems
    • References

Required Software

Two pieces of software are used troughout this manual. The versions are very important since I’ve seen that configuration varies quite a lot from one version to another, so please be sure you are working with the correct version:

Terminology

  • %
    • Text contained between percentage characters (%) represents a relative directory, meaning that it can vary from one computer to another. For example, the Java install directory is %JAVA_HOME%

Installation Steps

  1. Double clic on the CollabNetSubversion server installer.
  2. In the first screen, select the “Apache(MOD_DAV_SVN)” option only and click “Next”
    1. clip_image001
  3. Fill the forms as follows:
    1. Host/Server Name: localhost
    2. Host Port: 81 (or any free port you have, but usually 81 will work)
    3. Repository Path: C:\svn_repository
      1. This is the path where all versioned data will be stored. This directory causes confusion because it makes you think that you will find all your versioned files there, but the truth is that such information is stored in special files that only svn can read. Bottom line: don’t go to this directory looking for the actual files, you will only find svn configuration files that you must never touch.
    4. Repository Location Prefix: /svn
      1. This prefix tells the mod_dav to store all data in a “svn” folder. You can use any name you want here. More on this later.
    5. clip_image001[14]
  4. Open the file %CollabnetInstallDir%/httpd/bin/ApacheMonitor.exe
  5. In the ApacheMonitor, if the Apache service is not started, start it.
    1. clip_image001[16]
  6. Open your browser and go to http://localhost:81/
  7. The following page must appear (language may vary)
    1. clip_image002
  8. In the previous steps we have installed the Apache server, so now it’s time to add the svn configuration to it.
  9. Open the file %SVNInstallDir%/httpd/conf/httpd.conf
  10. Look for the “DynamicSharedObject” section
  11. In the “LoadModule” list, perform the following steps:
    1. Uncomment (remove the #) the following lines:
      1. #LoadModule dav_fs_module modules/mod_dav_fs.so
      2. #LoadModule dav_module modules/mod_dav.so
    2. Add the following line:
      1. LoadModule authz_svn_module modules/mod_authz_svn.so
    3. Verify that the following line is present (if not, add it):
      1. LoadModule dav_svn_module modules/mod_dav_svn.so
  12. Comment (add a # in the beggining of each line) the following block:
    1. DAV svn
    2. SVNParentPath C:/svn_repository
  13. At the end of the file, add the following lines:
    1. DAV svn
    2. SVNListParentPath on
    3. SVNParentPath C:/svn_repository <—again, may vary depending on the repository path you selected
    4. AuthType Basic
    5. AuthName “Subversion repositories”
    6. AuthUserFile passwd
    7. #AuthzSVNAccessFile svnaccessfile
    8. Require valid-user
  14. Don’t worry, by the end of this manual you will have a very clear idea of what each of the lines in the previous step mean.
  15. Save the file and close it.
  16. At this point, the SVN is already available but only for valid users. So let’s create one:
  17. Open a command line
  18. Go to the %CollabNetInstallDir%/httpd/ directory
  19. Execute the following command:
    1. bin\htpasswd –c passwd yourusername
      1. where:
        1. -c tells the htpasswd tool to create a file named passwd. This file will store all users and passwords
        2. yourusername is whatever you want to use as your user name
    2. The system will prompt for the user password. Type the password you want to set for that user and hit enter.
    3. From now on, to create new users you have to execute the following:
      1. bin/htpasswd username
      2. The diference is that you must now omit the –c command, otherwise your original passwd file will be replaced and your accounts will be lost.
  20. Restart the apache server trough the ApacheMonitor
  21. It’s time to test that the svn server is available:
  22. Open your browser and go to http://localhost:81/svn/ (the “/svn/” part is the one used as the “repository location prefix” when installing collabnet)
  23. The following window must appear:
  24. clip_image001[18]
  25. Login with the user you created above
  26. The following screen must appear:
  27. clip_image002[4]
  28. The screen is empty because we have not created repositories yet. Let’s do so:
  29. Go to the repositories directory (in this case, that would be C:\svn_repository)
  30. Create a new folder (preferably remove all white spaces)
  31. Right-clic on the new folder and select TortoiseSVN->Create repository here…
  32. clip_image002[6]
  33. Select the “Native Filesystem (FSFS) repository and clic OK
  34. clip_image001[20]
  35. Alternatively, the repository can be created from the command line:
    1. Go to C:\svn_repository
    2. Execute the following command:
      1. Svnadmin create –fs-type fsfs projectname
    3. If you would like to get further information about this step, please refer to the SVN Book, in the “The repository / Repository Creation” section
  36. Verify that your new folder looks as follows:
  37. clip_image002[8]
  38. Now the repository is ready to be checked out using any svn client, by connecting to http://localhost:81/svn/yourproject

Common problems

  • When creating the repository, this doesn’t contain the “dav” folder
    • This issue is related to the tortoise version you used. Please be sure you are using version 1.4.8.12137-win32-svn-1.4.6
  • The server cannot be accesed from a remote computer
    • This has more to do with your router configuration than with svn, and thus out of scope, but look on the internet on how to allow your router to redirect traffic to specific ports. In this manual we configured Apache to use port 81, and SVN by default uses 3690, so all yolu have to do is to tell your router to redirect traffic from those ports to your computer

References

  • Tortoise SVN Help
    • Right-click on any folder of your computer, then select Tortoise SVN  /Help
    • The sections “Setting up a server / apache based server” and “the repository / repository creation” covers almost everything that was seen on this manual
  • http://svnbook.red-bean.com
    • svn-book.pdf
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s