Click here to Skip to main content
15,070,680 members
Articles / Web Development / Apache
Posted 22 Sep 2006


51 bookmarked

How to set up Subversion with Apache in Windows (quick reference)

Rate me:
Please Sign up or sign in to vote.
3.88/5 (13 votes)
6 Oct 2006CPOL3 min read
Quick user guide to those who do not have time to learn how to set up Subversion with Apache.


I decided to write this article in order to save time to those people who must install and set up Subversion on Windows machines, having no idea of how to do that and no time to search for any piece of information on the internet.

It took two days for me and enormous efforts to understand what is going on with Subversion and how to make it work. I asked my friend who is working on a parallel project in the Computer Science department of my university how much time he spent setting up SVN with Apache on their Linux server. He told it took him one month!!! :) Well, no comments.

Let's get down to business, we don't have much time.


First of all, we need to download SVN and Apache.


Install Subversion to any directory, then add the bin sub-directory to the environment path. For example: if we installed svn into C:\programs\programming\svn-win32-1.4.0, then go to Start -> Settings -> Control Panel -> System.

Click on the Advanced tab and choose Environment Variables.




The next step is to create a directory which will be a root for all the repositories of our source control.

  • Open the command prompt.
  • Let's say that we want our root directory be named as c:\svnroot. Then, create this directory either in command prompt or using Explorer.
  • Create repositories in the svn root directories using the following commands:
    • svnadmin create c:\svnroot\test1
    • svnadmin create c:\svnroot\test2


Apache server

Now, we can install the Apache server.

When the installation is finished, go to the bin directory within the Subversion installation, find two files with extension *.so, and put them into the (Apache)/modules directory. The files are and

Go to the conf sub-directory within the Apache installation directory and open the httpd.conf file in any text editor.

Add the following lines:

LoadModule dav_module modules/
LoadModule dav_svn_module modules/
LoadModule authz_svn_module modules/

After that, add the following block:

<Location /svn/>
    DAV svn
    SVNParentPath c:/svnroot/ #specify the root for repositories
        post which discuss why you need to specify /svn/ and not /svn
    #list repositories
    SVNListParentPath on 
    # our access control policy
    AuthzSVNAccessFile bin/apachesvnauth #authentication file 
                   #path where policy is written for each user   

    AuthType Basic #type of authentication
    AuthName "Subversion repository" #the name of the authentication 
                                      #and the name of repository realm
    AuthUserFile bin/apachesvnpasswd #the name of the 
                                      #file with user passwords values
    Require valid-user #permit to log-in only for authorized users
  • <Location /svn/> - if you type in your browser something like this: http://localhost:8080/svn/, then Apache will know how to find your root repository using SVNParentPath.
  • SVNParentPath c:/svnroot/ - specify the root for the repositories.
  • SVNListParentPath on - permit to see the list of repositories using http://localhost:8080/svn/.
  • AuthzSVNAccessFile bin/apachesvnauth - authentication file path where the policy is provided for each user. The file is stored in the bin sub-directory of Apache.
  • AuthType Basic - the type of authentication.
  • AuthName "Subversion repository" - the name of the authentication and the name of the repository realm.
  • AuthUserFile bin/apachesvnpasswd - the name of the file with user password values, stored in the bin subdirectory of the Apache installation.
  • Require valid-user - permit to log-in only for authorized users.

Building the password file

We use the AuthUserFile bin/apachesvnpasswd entry, which tells Apache to find the file with passwords in the bin sub-directory within the Apache installation directory. We need to build this file. Go to that directory using the command prompt and type the following command:

htpasswd.exe -c apachesvnpasswd user1

You will be prompted to enter the password for user user1, and the file apachesvnpasswd will be created in the bin sub-directory. In order to add another user, just type the same command without -c and provide the name of another user.

htpasswd.exe -c apachesvnpasswd user2

Note: only the users we created will be able to log into our repositories because we used the Require valid-user parameter.

Building the authentication file

The following block is an example of the authentication file:

[/] * = r [test1:/] user1 = rw user2 = [test2:/] user1 = r user2 = rw


  • [/] * = r - gives access to everyone to read all the repositories
  • [test1:/] - gives read and write permissions to user1 for repository test1, and user2 can not read or write
  • [test2:/] - user1 can read from repository test2, and user2 has full access rights

Run Apache

Theoretically, we are at the stage when we can run Apache and test our Subversion. So start Apache, open the web browser and write something like this: http://localhost:8080/svn/.

If you don't get any errors, you will be prompted to type the username and password.


Provide the username you created and the password, and press OK. You will see the following page:




This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Kisilevich Slava
Germany Germany
No Biography provided

Comments and Discussions

QuestionApache Subversion Pin
helloworld20209-Oct-12 5:25
Memberhelloworld20209-Oct-12 5:25 
QuestionBeginners badluck Pin
kiranvk2728-Jul-10 23:58
Memberkiranvk2728-Jul-10 23:58 
GeneralI have another solution Pin
Ethan Woo14-Apr-10 17:08
MemberEthan Woo14-Apr-10 17:08 
GeneralRe: I have another solution Pin
Alex Manolescu13-Apr-11 9:55
MemberAlex Manolescu13-Apr-11 9:55 
Generalcannot list repositories or files! Pin
w00078782k3-Jul-09 8:14
Memberw00078782k3-Jul-09 8:14 
GeneralRegarding the block Pin
mpacaon29-Oct-08 20:23
Membermpacaon29-Oct-08 20:23 
GeneralRe: Regarding the block Pin
Kisilevich Slava29-Oct-08 22:51
MemberKisilevich Slava29-Oct-08 22:51 
GeneralRe: Regarding the block Pin
mpacaon2-Nov-08 15:02
Membermpacaon2-Nov-08 15:02 
QuestionConfused in doing the "Building the authentication file" step Pin
mpacaon28-Oct-08 18:36
Membermpacaon28-Oct-08 18:36 
AnswerRe: Confused in doing the "Building the authentication file" step Pin
Kisilevich Slava29-Oct-08 2:05
MemberKisilevich Slava29-Oct-08 2:05 
GeneralRe: Confused in doing the "Building the authentication file" step Pin
mpacaon29-Oct-08 20:18
Membermpacaon29-Oct-08 20:18 
QuestionWeird authentication issue, but only using Tortoise Pin
Regalarius9-Jul-08 19:47
MemberRegalarius9-Jul-08 19:47 
AnswerRe: Weird authentication issue, but only using Tortoise Pin
Kisilevich Slava9-Jul-08 20:16
MemberKisilevich Slava9-Jul-08 20:16 
GeneralComments on same lines as config causes Apache to fail to start Pin
Troy Simpson1-May-08 19:33
MemberTroy Simpson1-May-08 19:33 
GeneralRe: Comments on same lines as config causes Apache to fail to start Pin
Kisilevich Slava1-May-08 19:40
MemberKisilevich Slava1-May-08 19:40 
GeneralSubversion is showing too much Pin
niemkhuccuoi07011-Jun-07 16:46
Memberniemkhuccuoi07011-Jun-07 16:46 
GeneralRe: Subversion is showing too much Pin
Kisilevich Slava1-Jun-07 21:11
MemberKisilevich Slava1-Jun-07 21:11 
GeneralRe: Subversion is showing too much Pin
niemkhuccuoi07014-Jun-07 7:32
Memberniemkhuccuoi07014-Jun-07 7:32 
GeneralRe: Subversion is showing too much Pin
Kisilevich Slava4-Jun-07 9:39
MemberKisilevich Slava4-Jun-07 9:39 
GeneralRe: Subversion is showing too much Pin
stanhughes13-Jun-07 9:55
Memberstanhughes13-Jun-07 9:55 
GeneralRe: Subversion is showing too much Pin
VanbrabantP31-Oct-07 2:42
MemberVanbrabantP31-Oct-07 2:42 
Generalmod_authz_svn error Pin
Dmitry.S.Golub26-Sep-06 21:31
MemberDmitry.S.Golub26-Sep-06 21:31 
GeneralRe: mod_authz_svn error Pin
Kisilevich Slava26-Sep-06 23:22
MemberKisilevich Slava26-Sep-06 23:22 
GeneralRe: mod_authz_svn error Pin
Dmitry.S.Golub27-Sep-06 20:21
MemberDmitry.S.Golub27-Sep-06 20:21 
GeneralRe: mod_authz_svn error Pin
tlv779-Oct-06 7:29
Membertlv779-Oct-06 7:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.