Linux Sysadmin Blog

Setup Subversion (SVN) and Mod_dav_svn on Cpanel Server

- | Comments

Quick install guide for SVN with mod_dav_svn (http/https) repository access on Cpanel server running CentOs5.

Configure Cpanel for SVN

Recompile Apache/PHP (WHM -> Software -> EasyApache) and enable support for the following:

  • Dav (Among other things mod_dav can be used by DAV enabled Frontpage clients instead of FP extensions)
  • BerkeleyDB. Note: BerkeleyDB support (”–with-berkeley-db”) is not enabled by default in EasyApache so you need to add this manually to your EasyApache config using this guide or this one.

Install Subversion and mod_dav_svn

Install subversion using yum (yum install subversion) or install it from source. At this time CentOS repo version is 1.4.x and the latest from source is 1.6.x.

Install and enable mod_dav_svn in Cpanel

  • Install mod_dav_svn using yum (yum install mod_dav_svn) - version 1.4.x same as subersion above.
  • Load mod_dav_svn module to Apache. Go to WHM -> Service Configuration -> Apache Configuration -> Include Editor -> Pre-Main Include. Select either ”All Versions” or your current Apache version (ex: ”2.2.16”) from drop-down list. Or you can edit their corresponding file directly:
    • All Versions: /usr/local/apache/conf/includes/pre_main_global.conf
    • Apache 2.2.16: /usr/local/apache/conf/includes/pre_main_2.conf
  • Add the codes below and click ”Update” button to save config. This will restart Apache if no error on your configuration.
1
2
3
4
<IfModule mod_dav.c>
LoadModule dav_svn_module /usr/lib/httpd/modules/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/httpd/modules/mod_authz_svn.so
</IfModule>

Create repository and add http access (ex: http://domain.com/svn)

  • Create your repository: svnadmin create /path/to/svn/repos
  • Add the code below to your domain’s custom include file. You need to create this file based on this guide to preserve when you recompile Apache/PHP. Example file (Apache2,standard/non-ssl): /usr/local/apache/conf/userdata/std/2/cpanl_user/domain.com/svn.conf File Contents:
1
2
3
4
5
6
7
8
9
10
11
12
13
<Location /svn>
#  mod dav svn support and location of svn repo files
DAV svn
SVNPath /path/to/svn/repos
# authentication for security, create using htpasswd
AuthType Basic
AuthName "SVN Access"
AuthUserFile /path/to/file/containing/user.pass
Require valid-user
# added for permissions/access
Order allow,deny
Allow from all
</Location>

Comments