Monday 28 November 2011

  1. Install TortioseSVN from http://tortoisesvn.net/downloads
  2. Right click on an empty folder and choose TortoiseSVN -> Create repository Here
  3. Install Apache Windows Server from http://httpd.apache.org/download.cgi
  4. Get 'Subversion Win32 binaries for Apache' from http://sourceforge.net/projects/win32svn/ and put in C:\svn
  5. Copy C:\svn\bin\mod_authz.svn.so and C:\svn\bin\mod_dav_svn.so to C:\Program Files\Apache Software Foundation\Apache2.2\modules. Also give the apache user permission to the 2 copied .so files. Copy the .dlls from the subversion bin folder to the Apache2/bin and Apache2/modules folder.
  6. Edit C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
    Add/uncomment the following lines to the LoadModule section:
    LoadModule dav_module modules/mod_dav.so
    LoadModule dav_fs_module modules/mod_dav_fs.so
    LoadModule dav_svn_module modules/mod_dav_svn.so
    LoadModule authz_svn_module modules/mod_authz_svn.so
    
  7. Add the following to the end of the file <Location /svn/>                                                                                                                     
    DAV svn
    SVNPath (path to the svn repository you made)
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile passwd
    #AuthzSVNAccessFile svnaccessfile
    
    #allow only authenticated users to access
    Require valid-user
    
    # allow read access to all, write access to authenticated users only
    #Order deny,allow
    #
    #      Require valid-user
    #
    </Location> 
    
  8. Next you need to create some users that can access your SVN repository through Apache
    Open command prompt at C:\Program Files\Apache Software Foundation\Apache2.2
    bin\htpasswd.exe -c passwd (username you want to add)
    
    Note: it will prompt to set the user's password
  9. run the Apache Server
  10. On the router, make sure to enable port forwarding for TCP port 80 (www) and 3690 (svn)
  11. Test the Apache Server to make sure it's working:
    http://localhost -> does the web server work?
    http://localhost/svn -> does mod_dav, svn modules & authentication work on the server?
    http://123.201.210.11 -> (this is your external ip) does remote access work for the server?
  12. Next you need to set up authentication for the actual SVN service (this is different than the Apache authentication in step 8).
    Go to the directory you created your repository in (step 2) and go into the conf subdirectory.
    edit the passwd file with a text editor and add a user and password in there (there should be commented out examples):
    [users]
    testusername = testpassword
    
  13. Open svnserve.conf in that same directory with a text editor.
    make sure you have something like the following in there that's uncommented:
    anon-access = none       # this disallows anonymous people from accessing the repository, you can set this to read also
    auth-access = write      # read/write access for authenticated users
    password-db = passwd     # make sure this is uncommented, it's commented by default
    
  14. Next we need to install the SVN service
    Open command prompt at C:\svn\bin
    sc create svn.local binpath= "\"c:\svn-win32-1.5.2\bin\svnserve.exe\" --service --root F:\work\Andrograde\svn" displayname= "Subversion Repository" depend= Tcpip
    
    Next go to Services and turn the service on
    services.msc
    go to Subversion Repository -> click start (optionally set it to Automatic)
    
  15. Test the repo-browser:
    right click on a folder -> tortoiseSVN -> Repo-browser
    svn://localhost -> test if it works internally
    svn://123.201.210.11 -> (this is your external ip) test if it works remotely
  16. remember to start the service using : net start <service name> with admin permissions.