Setting up SVN Server using Windows and Apache
Purpose of the document:
This article will explain the process of how to configure SVN repository in a windows environment using APACHE web server.
What is SVN? (http://subversion.tigris.org/
Subversion (SVN) is a version control system initiated in 1999 by CollabNet Inc. It is used to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly-compatible successor to the widely used Concurrent Versions System (CVS).(WIKI link : http://en.wikipedia.org/wiki/Svn_%28software%29
" APACHE web Server
The latest version of APACHE is Apache HTTP Server 2.2.14, more information on installation and download details is available in APACHE web site. http://httpd.apache.org/download.cgi
. If you already have IIS running on your machine please make sure you set a different port number for APACHE installation, more info here http://httpd.apache.org/docs/2.0/platform/windows.html
(thanks to Garth J Lancaster for pointing out the link)
" SVN Server
SVN can be downloaded from the following URL
File name: Setup-Subversion-1.6.4.msi
" Tortoise SVN or equivalent client
For accessing the SVN repository you will need client software that needs to be installed, Tortoise SVN is one of the client tools for accessing SVN repository. It can be downloaded from http://tortoisesvn.net/downloads
IT IS ADVISABLE TO RESTART YOUR MACHINE AFTER THE INSTALLATION.
Setting up the repository
STEP 1: Creating a repository
On the server, create a directory D:\SourceCodeRepos, this directory will hold the files of our source code repos.
Open Command Prompt and type
svnadmin create D:\SourceCodeRepos
(If you get an error bad command or filename then add the SVN bin path to the environment variables. Go to Desktop à right click MyComputer > Properties > -> Advanced -> Environment Variables > Path > Edit > dont overwrite the existing one> copy the bin path of SVN (generally it is c:\Program Files\Subversion\bin) in the end.)
STEP 2: Configure APACHE to work with SVN
Copy the SVN modules to APACHE
The SVN modules are available inside (C:\Program Files\Subversion\bin), copy these two files (mod_authz_svn.so and mod_dav_svn.so) to c:\Program Files\Apache Software Foundation\Apache2.2\modul
Open C:\Program Files\Apache Software Foundation\Apache2.2\conf\
, and append the following lines to it
#This will load the SVN modules so that APACHE can communicate with SVN Server
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
Add the following line to the end of the same conf file
Step 3: Configure Authentication parameters and SVN Repository link
Create a new directory c:\etc. Create 3 files inside this directory
Name of the file
Content of the file
AuthName "Subversion Kinetics repository"
name of the file
Name of the file
Content of the file
# specify groups here
developers = harry,sally
# team1 group has a read/write access to source code repository
# all subdirectories
# all others have read access only
@developers = rw
* = r
Now RESTART the APACHE WEB SERVER, so that it can load the SVN modules and point to your directory.
Step 4: Setting up authentication parameters
Now that the repository is configured we need to create the username / password for accessing the repository
htpasswd -m c:\etc\svn-auth-file user1
htpasswd -m c:\etc\svn-auth-file user2
htpasswd -m c:\etc\svn-auth-file user3
This will create 3 users and the usernames will be appended to the svn_auth_file that was created in the previous step.
Checking your Configurations
Open the URL from the server as http://localhost/SourceCodeRepos
, this will list the current version number of the repository.
Now from any other machine (connected to the server), install Tortoise SVN and create a new working folder (eg: D:\Dev), Windows explorer to the folder D:\Dev, right click and select SVN Checkout, specify the URL of your source code control, (eg: http://servername/SourceCodeRepos
) if asked for username and password, please provide the username and password that you have created in the earlier steps. Your SVN Source repository is ready to use.
Now test your environment by adding a new file to the repos and committing the changes. More information on how to create new files / folders is available in the SVN book which is freely downloadable.