SVN Installation in Cpanel

In order to install SVN in server, we need mod_dav module in cpanel. Run the following command and check if the below modules are present:

httpd -M | grep dav
dav_module (static)
dav_fs_module (static)
dav_lock_module (static)
dav_svn_module (shared)

If dav_module is not installed in the server, you can enable it by running easyapache in the server. Enable DAV, DAVfs, DAVLock from the apache modules and build apache.

Next step is to install subversion in the server. For that, perform the following steps:

cd /usr/local/src/
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
rpm -i rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

Once the repository is installed, install subversion using the following command:

yum –enablerepo=rpmforge install subversion

Now to build dav_svn_module, perform the following steps:

cd /usr/local/src
wget http://subversion.tigris.org/downloads/subversion-1.6.3.tar.bz2
tar xfj subversion-1.6.3.tar.bz2
cd subversion-1.6.3
./configure –with-apxs=/usr/local/apache/bin/apxs –with-apr=/home/cpeasyapache/src/httpd-2.2.21/srclib/apr –with-apr-util=/home/cpeasyapache/src/httpd-2.2.21/srclib/apr-util
make
make install

If you get an error that sqlite-amalgamation needs to be installed, perform the following steps:

cd /usr/local/src
wget http://www.sqlite.org/sqlite-amalgamation-3.6.13.tar.gz
tar -zxvf sqlite-amalgamation-3.6.13.tar.gz
cd subversion-1.6.3
mkdir sqlite-amalgamation
cp ../sqlite-3.6.13/sqlite3.c ./sqlite-amalgamation/

Then build it again using the following commands:

./configure –with-apxs=/usr/local/apache/bin/apxs –with-apr=/home/cpeasyapache/src/httpd-2.2.21/srclib/apr –with-apr-util=/home/cpeasyapache/src/httpd-2.2.21/srclib/apr-util
make
make install

Now we need to configure apache and subversion.

mkdir -p /usr/local/apache/conf/userdata/std/2/<user>/<domain>/
vi svn.conf

Add the following lines to the file svn.conf

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

Add the username and password in the file /home/<username>/.svn.htpasswd using htpasswd command

htpasswd -cm /home/<username>/.svn.htpasswd username

In the file /usr/local/apache/conf/includes/pre_main_2.conf, add the following:

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

Now we need to create the SVn repository.

cd /home/<username>/public_html/
svncreate admin name_of_svn
chown -R user:user name_of_svn
chmod -R 775 name_of_svn

Now rebuild apache config and restart apache using the following commands:

/scripts/ensure_vhost_includes –user=username
/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd

That’s all.

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: