Install and configure SVN WebDAV server on a CentOS 6 VPS

webdav-logoThis how-to looks at how to install and configure a SVN (subversion) WebDAV accessible repository server using Apache and a CentOS VPS. What is SVN? It is an open-source centralized version control system, which can track and store the history of files and directories in its repositories with the ability to examine the history of how the data changed and if needed to recover some older versions of the data.

For this tutorial we are using a CentOS 6 based VPS, but the installation and configuration of a SVN repository server accessible via HTTP using the WebDAV protocol is almost the same on any other Linux based VPS.

1. Assuming you have ‘root’ privileges, execute the following command in order to fully update your system and to install the needed packages.

# yum -y update && yum -y install mod_dav_svn subversion

Next, we’re going to create and configure the subversion users and repositories.

2. To create the initial svn user use the following command:

# htpasswd -cm /etc/svn_htpasswd user1

it will create the user ‘user1’ and will create the ‘/etc/svn_htpasswd’ file which will hold the svn usernames along with their encrypted passwords.

(to create additional svn users you need to omit htpasswd’s ‘-c’ switch, for example:

# htpasswd -m /etc/svn_htpasswd user2

3. Next, create the repositories using the following commands:

# mkdir /var/www/repos
# svnadmin create /var/www/repos/test_repo1
# svnadmin create /var/www/repos/test_repo2
# chown -R apache: /var/www/repos/

In order to have the repositories accessible via HTTP, we need to configure the subversion apache configuration file.

4. Create or modify subversion’s configuration file ‘/etc/httpd/conf.d/subversion.conf’ as follows:

# cat /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module     modules/
LoadModule authz_svn_module   modules/

<Location /repos>
   DAV svn
   SVNParentPath /var/www/repos
   AuthType Basic
   AuthName "Subversion repositories"
   AuthUserFile /etc/svn_htpasswd
   Require valid-user
   AuthzSVNAccessFile /etc/svn_acl

next restart the apache webserver, so the changes can take effect. Issue the following command to reload apache:

# service httpd restart

(if you get something like this: ‘ undefined symbol: dav_register_provider’, then most likely you need to activate the ‘‘ and ‘‘ apache modules in its core configuration file ‘/etc/httpd/conf/httpd.conf’)

5. Disable anonymous access to the repository and enable ACL (access control list) instead. To do this add the following two lines to the repo’s ‘svnserve.conf‘ configuration file:

# cat /var/www/repos/test_repo1/conf/svnserve.conf



## Disable anonymous access ##
anon-access = none

## Enable access control ##
authz-db = authz

6. Create the SVN access list, so we can assign different access levels to the users. For example:

# cat /etc/svn_acl

group1 = user1
group2 = user2
group3 = user3, user4

* = r
@group1 = rw
user1 = rw

@group1 = rw
@group2 =

@group2 = r

@group3 = rw
user2= r

7. Finally, create ‘static’, ‘documentation’ and ‘code’ repository structure under the ‘test_repo1’ repository. 

Create ‘template’ directories with following command:

# mkdir -p /tmp/test_repo1/{code,static,documentation}

once they’re created you can import the directories into the ‘test_repo1’ repository by executing the following command:

# svn import -m 'Testing ...' /tmp/test_repo1/ http://yourdomain.tld/repos/test_repo1/

Now you can access the newly created SVN repository via HTTP protocol at ‘http://yourdomain.tld/repos/test_repo1/’. An authorization window will popup where you have to login with the appropriate svn user.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

4 thoughts on “Install and configure SVN WebDAV server on a CentOS 6 VPS”

  1. In your svnserve.conf you point to the authz in the local dir and not to the authz in the /etc.. Is that a mistake or am I missing something?


    • Since the repositories are accessed via apache mod_dav, the configuration file in /etc/svn_acl is used. the authz in the local directory isn’t used in this case.

        • You need to create a SVN access list file (/etc/svn_acl), so you can assign different access levels to your users. Please read the step 6 of this tutorial for more information on this.


Leave a Comment

To prove you are human please solve the following *