Subversion (SVN) is an open source version control system. It helps you keep track of a collection of files and folders. Any time you change, add or delete a file or folder that you manage with Subversion, you commit these changes to your Subversion repository, which creates a new revision in your repository reflecting these changes. You can always go back, look at and get the contents of previous revisions.
This article will help you for step by step setup SVN server on a cPanel/WHM server.
Prerequisite
1. sqlite3 php module
2. Apache mod_dav module.
Installing php sqlite3 module
Run the following command in the server terminal
#php -m | grep sqlite
If the module is installed already, it will return
sqlite3
If the module is not enabled, run easyapache to enable the module
Installing mod_dav (if needed)
Run the following command in the terminal:
#httpd -M | grep dav
If mod_dav is already installed, it will return:
dav_module (static)
dav_fs_module (static)
If this module is already enabled, run EasyApache and enable this module.
Note: If both sqlite3 and mod_dav is not enabled, you can install them in a single EasyApache.
Install Subversion
In order to properly configure latest version of Subversion it needs to be compiled from its sources. Download and install subversion using the following commands.
Always check the https://subversion.apache.org/download/ for the latest version
#cd /usr/local/src/
#wget http://mirror.cc.columbia.edu/pub/software/apache/subversion/subversion-1.8.10.tar.gz tar xzvf subversion-1.8.10.tar.gz //unzip the file
#cd subversion-1.8.10/
#./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/srclib/apr-util/
Latest version of sqlite3 is needed. If the configure fails with following error:
—————————————————————————————————
An appropriate version of sqlite could not be found. We recommend 3.7.15.1, but require at least 3.7.12.
Please either install a newer sqlite on this system
or
get the sqlite 3.7.15.1 amalgamation from:
http://www.sqlite.org/sqlite-amalgamation-3071501.zip
unpack the archive using unzip and rename the resulting
directory to:
/usr/local/src/subversion-1.8.10/sqlite-amalgamation
—————————————————————————————————
Then run following commands to enable latest sqlite3
#wget http://www.sqlite.org/sqlite-amalgamation-3071501.zip
#unzip sqlite-amalgamation-3071501.zip
#mv sqlite-amalgamation-3071501 sqlite-amalgamation
And run the configure again. It should work.
If the configure fails with following error
—————————————————————————————————
checking for APR… configure: error: the –with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.
—————————————————————————————————
You need to correct the “–with-apr-util=” path specified. Look for httpd-*.*.** (where the stars are your script version) and update accordingly and run the configure, make and make install commands.
Subversion and Apache
When using WHM and EasyApache, you can’t just modify the Apache configuration to include the Subversion modules. Instead, you must use the Include Editor, which you can find by browsing to “Apache Configuration” in the WHM menu. There, you must use the Pre Main Include. Select the latest Apache version from the dropdown list and a textarea will appear. Add the following to it and click on “Update”:
LoadModule dav_svn_module /usr/local/libexec/mod_dav_svn.so
LoadModule authz_svn_module /usr/local/libexec/mod_authz_svn.so
Set up your repository
use one repository per domain / subdomain. These instruction will work for multiple repositories.
For our explaining, consider the domain name is supportpro.com and support is the cPanel username.
First, you need to add a new virtual host for your repository:
#mkdir -p /etc/httpd/conf/userdata/std/2/support/supportpro.com
Next, you need to create the Subversion config file
#vi /etc/httpd/conf/userdata/std/2/support/supportpro.com/svn.conf
And copy following to the svn.conf file. For every repository you wish to create, add another <location> block.
<IfModule mod_dav_svn.c>
<Location /svn>
DAV svn
SVNPath /home/support/public_html/svn
AuthType Basic
AuthName “SupportPro SVN”
AuthUserFile /home/support/public_html/passwd
Require valid-user
</Location>
</IfModule>
Tell cPanel to update the Apache configuration to use the custom vhost includes:
#/scripts/ensure_vhost_includes –all-users
#service httpd restart
Now, create the actual repository files:
#su svnaccount –
#cd public_html
#svnadmin create svn
#chmod 775 -R svn
Add Subversion users
#/usr/local/apache/bin/htpasswd /home/support/public_html/passwd username
//enter password when asked.
Test
Go to http://supportpro.com/svn to test your repository. It should ask for your user and password.
If you require help, contact SupportPRO Server Admin