Installing Subversion on Cpanel/WHM

Make and install Subversion:

mkdir -p /usr/local/src/
wget http://subversion.tigris.org/downloads/subversion-1.5.2.tar.bz2
tar xfj subversion-1.5.2.tar.bz2 && cd subversion-1.5.2
./configure --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/local/apache/bin/apr-1-config --with-apr-util=/home/cpeasyapache/src/httpd-2.2.17/srclib/apr-util
make && make install

Add to pre-main include in Apache Configuration (WHM):

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

Set up EasyApache’s per-user virtualhost config directories (if not present):

mkdir /etc/httpd/conf/userdata
mkdir /etc/httpd/conf/userdata/std
mkdir /etc/httpd/conf/userdata/std/2

Add a virtualhost config file for the user and domain who needs subversion:

mkdir /etc/httpd/conf/userdata/std/2/<username>
mkdir /etc/httpd/conf/userdata/std/2/<username>/<www.domain.com_or_subdomain>
nano -w /etc/httpd/conf/userdata/std/2/<username>/<www.domain.com_or_subdomain>/svn_custom.conf

Paste in the config:

<IfModule mod_dav_svn.c>
 <location /repo>
  DAV svn
  SVNPath /home/<username>/public_html/repo/svn
  AuthType Basic
  AuthName "SVN Repo"
  AuthUserFile /home/<username>/.svn.htpasswd
  Require valid-user
 </location>
</IfModule>

Create the SVN user and filesystem:

su <username>
cd ~/
htpasswd -cm .svn.htpasswd <svnuser>
mkdir public_html/repo
cd public_html/repo
svnadmin create svn
chmod 775 -R svn
exit

Update the apache config:

/scripts/ensure_vhost_includes --all-users

Test by opening http:///repo/ in browser and authenticating.

4 Responses to Installing Subversion on Cpanel/WHM

  1. Google alot of pagess/sites purporting to have good instructions on installing SVN on a WHM/cPanel Cento OS 5 machine but yours were by far the most inclusive and clear ones we did run into trouble because we didnt have dav_modules installed built a quick rebuild of apache to include it and then re run your instructions and it was easy peasy thank you Sir you rock!

    Kinetic

  2. Reynold says:

    Really excellent write-up. 🙂

    For setting up svn server using ‘svnserve’ daemon refer “http://jackal777.wordpress.com/2013/06/08/sync-svn-repo-commits-to-website-documentroot-in-cpanel-server/”

  3. sudeep says:

    hi i m new for these concepts. where i have to write above codes? i mean in local command prompt or in some other? plz help me

  4. PnS Hostings says:

    Nice and simple guide .

    Working great.

    Thanks for sharing this info.