Dawal,
Community Resources for Software Engineering
you are here: Home Tools & Products Subversion Installing Subversion + WebDAV access on GNU/Linux

Login

Installing Subversion + WebDAV access on GNU/Linux
Written by Boris Baldassari   
Saturday, 10 April 2010 19:11

This article describes the setup of Subversion 1.4 and Apache in webdav mode on a GNU/Linux CentOS 5 host.

We will install the Subversion repositories in /usr/local/svn directory, because it's convenient for our purpose. It is probably not right for you, adapt to your needs.

We start from a fresh OS install. Subversion version 1.4.2 is already installed.


[root@polarionlive ~]# svn --version
svn, version 1.4.2 (r22196)
compilé Aug 10 2009, 18:00:04

Copyright (C) 2000-2006 CollabNet.
Subversion est un logiciel libre, cf http://subversion.tigris.org/
Il inclut du logiciel développé par CollabNet (http://www.Collab.Net/).

Les modules d'accès à un dépôt (RA) suivants sont disponibles :

* ra_dav : Module d'accès à un dépôt via le protocole WebDAV/DeltaV.
- gère le schéma d'URL 'http'
- gère le schéma d'URL 'https'
* ra_svn : Module d'accès à un dépôt avec le protocole réseau propre de svn.
- gère le schéma d'URL 'svn'
* ra_local : Module d'accès à un dépôt sur un disque local.
- gère le schéma d'URL 'file'

First check that subversion is working correctly. Create a repository, create a system group for subversion users, add your users to this group.

[root@polarionlive ~]# mkdir /usr/local/svn
[root@polarionlive ~]# svnadmin create /usr/local/svn/repo
[root@polarionlive ~]# groupadd subversion
[root@polarionlive ~]# emacs /etc/group
[root@polarionlive ~]# chgrp -R subversion /usr/local/svn/
[root@polarionlive ~]# chmod -R 770 /usr/local/svn/
[root@polarionlive ~]# ls /usr/local/svn/repo/
conf  dav  db  format  hooks  locks  README.txt
[root@polarionlive ~]# ls /usr/local/svn/repo/conf/
authz  passwd  svnserve.conf

This will be enough if you plan to use subversion in local (svn or svn+ssh) or webdav modes only.

If you intend to use svnserve, you'll need to setup users access on the svn repository: edit the svnserve.conf file, uncomment the anon-access, auth-access and password-db lines. Note however that Webdav does NOT need the svnserve daemon.

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
anon-access = read
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the conf directory.
### Uncomment the line below to use the default password file.
password-db = passwd

Then modify the passwd file in the conf directory and add your users and their passwords.

[users]
boris =    password
sebastien = password
alexis = password

Then start the svnserve daemon.

 

Apache module for Webdav SVN

The apache modules need to be manually installed. Install mod_dav_svn.


root@polarionlive ~]# yum install mod_dav_svn
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.crazyfrogs.org
* base: centos.crazyfrogs.org
* extras: centos.crazyfrogs.org
* updates: centos.crazyfrogs.org
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mod_dav_svn.i386 0:1.4.2-4.el5_3.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================
Package        Arch        Version        Repository       Size
=====================================================================
Installing:
mod_dav_svn      i386       1.4.2-4.el5_3.1    base      70 k

Transaction Summary
=====================================================================
Install      1 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)

Total download size: 70 k
Is this ok [y/N]: y

Downloading Packages:
mod_dav_svn-1.4.2-4.el5_3.1.i386.rpm            |  70 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : mod_dav_svn                     1/1

Installed:
mod_dav_svn.i386   0:1.4.2-4.el5_3.1

Complete!
[root@polarionlive ~]#

Then edit the /etc/httpd/conf.d/subversion.conf file. Add the following text (or uncomment and modify the existing one).

<Location /svn>
 DAV svn
 SVNParentPath /usr/local/svn

 # Limit write permission to list of valid users.
 <LimitExcept GET PROPFIND OPTIONS REPORT>
 # Require SSL connection for password protection.
 # SSLRequireSSL

 AuthType Basic
 AuthName "Subversion Repository"
 AuthUserFile /etc/httpd/conf/subversion.passwd
 Require valid-user
 </LimitExcept>
</Location>

We can access the new svn webdav repository at http://localhost/svn/repo.

Note that the repositories are postponed to the SVNParentPath. That is, if you want to add another repository to the webdav server follow these steps:

cd /usr/local/svn
svnadmin create stuff
chown -R apache.subversion stuff

And access it at http://localhost/svn/stuff.

 

 

 

Add comment

Please respect this work and community, do not abuse it.


Security code
Refresh