Setting Up Apache Subversion on Windows 🌱

Installing Subversion

  1. Download Microsoft Visual C++Download
  2. Download TortoiseSVN Download
  3. Install Microsoft Visual C++
  4. Install TortoiseSVN, making sure to enable the command line client tools option

Installing and Configuring Apache HTTPD

  1. Download Apache HTTPD Download
  2. Download Subversion Apache Modules Download
  3. Extract the downloaded .zip files
  4. Copy the extracted Subversion files to the desired location, for example C:\Program Files\Subversion
  5. Click the Start button > Search Control > Click Control Panel
  6. Click on System > Advanced system settings
  7. Click the Environment Variables...
  8. Edit the System Path variable
  9. Add the Subversion /bin path
  10. Click OK
  11. Open a command prompt and run svn --version to confirm the Subversion executables are configured in the system path correctly
  12. Copy the following files from the extracted Subversion directory to the Apache installation directory specified below:

    Apache /modules
    mod_dav_svn.so
    mod_authz_svn.so
    deps/brotlicommon.dll
    deps/brotlidec.dll
    deps/brotlienc.dll
    deps/libapr-1.dll
    deps/libapriconv-1.dll
    deps/libaprutil-1.dll
    deps/libcrypto-1_1-x64.dll
    deps/libexpat.dll
    deps/libhttpd.dll
    deps/libserf-2.dll
    deps/libssl-1_1-x64.dll
    deps/zlib1.dll
    Apache /bin
    libsvnjavahl-1.dll
    libsvn_client-1.dll
    libsvn_delta-1.dll
    libsvn_diff-1.dll
    libsvn_fs-1.dll
    libsvn_fs_fs-1.dll
    libsvn_fs_util-1.dll
    libsvn_fs_x-1.dll
    libsvn_ra-1.dll
    libsvn_repos-1.dll
    libsvn_subr-1.dll
    libsvn_wc-1.dll

  13. Inside the extracted Apache file structure, navigate to /conf/httpd.conf and edit it with a text editor
  14. Find the following lines LoadModule dav_module modules/mod_dav.so and uncomment them by removing the # at the beginning

    LoadModule access_compat_module modules/mod_access_compat.so
    LoadModule dav_module modules/mod_dav.so

  15. Add the following block to the file:

    LoadModule dav_svn_module modules/mod_dav_svn.so
    LoadModule authz_svn_module modules/mod_authz_svn.so

    <VirtualHost svn.i12bretro.local:80>
    ServerName svn.i12bretro.local
    ServerAlias i12bretro.local
    DocumentRoot E:\SVN_Repos

    <Location />
    DAV svn
    SVNListParentPath On
    SVNParentPath E:\SVN_Repos

    Order allow,deny
    Allow from all
    </Location>
    </VirtualHost>

  16. Save the changes
  17. To just start Apache and have it run, double click the httpd.exe in the Apache /bin directory
  18. To run Apache as a Windows server, hold the shift key and right click in the Apache /bin directory > Open command window here
  19. Enter the following command to create the Apache service:
    httpd.exe -k install -n "Apache HTTPD"
  20. Open a web browser and navigate to http://svn.i12bretro.local
  21. A bare bones directory listing of the "Collection of Repositories" should be displayed

Setting Up LDAP Authentication

  1. Navigate to the Apache install directory/conf in Explorer
  2. Edit httpd.conf in a text editor
  3. Find both the authnz_ldap_module and ldap_module and make sure it is enabled by removing the # at the start of the line

    LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
    LoadModule ldap_module modules/mod_ldap.so

  4. Add the following to the Location block created earlier for svn.i12bretro.local to enable LDAP authentication

    Order deny,allow
    # Basic authentication with LDAP against MS AD
    AuthType Basic
    AuthBasicProvider ldap

    # AuthLDAPURL specifies the LDAP server IP, port, base DN, scope and filter
    # using this format: ldap://host:port/basedn?attribute?scope?filter
    AuthLDAPURL "ldap://i12bretro.local:389/DC=i12bretro,DC=local?sAMAccountName?sub?(objectClass=user)" NONE

    # The LDAP bind username and password
    AuthLDAPBindDN "readonly_svc@i12bretro.local"
    AuthLDAPBindPassword "Read0nly!!"
    LDAPReferrals Off
    AuthUserFile /dev/null

    AuthName "Restricted Area [i12bretro.local]"
    # to authenticate a domain group, specify the full DN
    AuthLDAPGroupAttributeIsDN on
    require ldap-group CN=WebAuthAccess,CN=Users,DC=i12bretro,DC=local

  5. Save httpd.conf
  6. Restart the Apache service
  7. Open a web browser and navigate back to http://svn.i12bretro.local
  8. An authentication prompt should be displayed
  9. Enter a valid username and password for a user belonging to the group specified above
  10. A bare bones directory listing of the Subversion repositories should be displayed