Thursday, 11 June 2015

How to configure TortoiseSVN repository with Apache and Subversion?


 Configuring SVN repository


        Most of us know how to install and use SVN Client. But we never get a chance to configure a repository and provide a http url for version control. This blog is about creating one such repo and make it available over http. Installing SVN and making a folder as a repository will only make it available locally but to access it over http from other systems, we need servers like svnserve or apache etc. We will learn about configuring svn with apache in this blog! :)
1.      Download and install TortoiseSVN 1.8.11, in the server, from “http://tortoisesvn.net/downloads.html”.

2.      Create a folder in D:\ drive with the name “SVNRoot”.

3.      Create a new folder under any drive, say E:\SVNRoot.

4.      Right click on the newly created folder and select “Create repository here” option under TortoiseSVN. Thus a repository is created locally. To make it available over http, we will configure it using Apache and subversion as mentioned below.




Fig. Creating SVN repository

 5.      Download Apache server binary version “Apache 2.4.12 x64” from “https://www.apachehaus.com/cgi-bin/download.plx”.


6.      Download Subversion modules for Apache – “Mod Subversion 1.8.11 for Apache 2.4.x x64” from “https://www.apachehaus.com/cgi-bin/download.plx”.

 

                                    Fig. Downloaded Apache Server and Subversion Modules

 7.      Copy the following subversion modules into Apache modules:

a.       mod_dav_svn.so

b.      mod_authz_svn.so

Subversion modules source path: “mod_svn-1.8.11-ap24-vc9-x64\modules”

Apache modules destination path: “httpd-2.4.12-x64-r2\Apache24\modules

8.      Copy all the dll files from “mod_svn-1.8.11-ap24-vc9-x64\bin  to “httpd-2.4.12-x64-r2\Apache24\bin

 

                                          Fig. dll files to be copied

9.      Open the “httpd.conf” file from the Apache server folder - “httpd-2.4.12-x64-r2\Apache24\conf” in notepad and make the following changes:

 
a.       Update “Listen 80” to “Listen 8078” or any other port number.

b.      Update “Define SRVROOT path to “Define SRVROOT "E:/final/httpd-2.4.12-x64-r2/Apache24"”

c.       Update ServerName to “ServerName localhost:8078”.

d.      Add the following code at the end of the file:

 
LoadModule dav_module modules/mod_dav.so

LoadModule dav_svn_module modules/mod_dav_svn.so

LoadModule authz_svn_module modules/mod_authz_svn.so

 

<Location /repos>

  DAV svn

  SVNListParentPath on

  SVNParentPath D:/SVNroot

</Location>

SVNParentPath path should point to the root directory of the repositories.
We can also add authentication details in the <Location></Location> section.

10.  Save the httpd.conf file and open the cmd prompt as administrator.

11.  Navigate to the Apache bin folder(httpd-2.4.12-x64-r2\Apache24\bin) in the cmd prompt and execute the following command:

 
httpd.exe –k install

 
12.  Now the repository will be available over http and we can check-in and checkout the code using the TortoiseSVN client in our local systems. :)