How To Install Subversion On cPanel Server With Apache

This guide will help you to install SVN on a cPanel based server and configure it with Apache for ease of access.

In this tutorial, we will focus on creating multiple repositories instead of a single repository.

 

Prerequisites

This setup is for servers with cPanel/WHM only. This can be installed on any cPanel/WHM server.

 

Download cPanelSVNManager and installl it

[bash]

wget http://technicalnotebook.com/wiki/download/attachments/3473493/cPanelSVNManager_0.3.zip
unzip cPanelSVNManager_0.3.zip
cd cPanelSVNManager_0.3
sh install.sh

[/bash]

 

Select 1 from the menu and press Enter. This will install the latest version of the SVN and add necessary modules to Apache ( DAV etc )

Creating Configuration File

 

Assuming the following,

Domain Name: www.vivekv.com
Username: vivek

Open the file

/usr/local/apache/conf/includes/pre_main_global.conf and append the below block to that file

[code]

<Location /svn>
DAV svn
SVNParentPath /home/vivek/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /home/vivek/svn/password
Require valid-user
</Location>
[/code]

 

Note: This would open /svn for all domains hosted in the account. If you would like to enable /svn path only for a specified domain, save this block of code into /usr/local/apache/conf/userdata/std/2/vivek/vivekv.com/svn.conf

 

Save the file and exit from the editor. Now create svn directory

 

[bash]

mkdir /home/vivek/svn
chgrp -R nobody /home/vivek/svn
chmod -R g+w /home/vivek/svn

[/bash]

This would create the svn parent directory and setup correct folder permission so that apache can read it. By default, apache runs as nobody on cPanel server, therefore, the group should be changed to nobody so that apache has full read and write permission

Now, all our configurations have been completed and we have left with two tasks.

1. Create valid users
2. Create repositories

To create valid users who can log into svn type

[bash]

/usr/local/apache/bin/htpasswd -c /home/vivek/svn/password admin

[/bash]

where “admin” is the username. You will be asked to enter a password. Type a password and continue. If you would like to add more users, simply use the same command but remove -c from the command.

To verify,type

[bash]

cat /home/vivek/svn/password

[/bash]

 

To create a sample repository,

[bash]

cd /home/vivek/svn
svnadmin create sample

[/bash]

 

Now, you would be able to access the repository under http://vivekv.com/svn/sample using the username and password that you just created.

Hope this helps

Leave a Reply

Your email address will not be published. Required fields are marked *