Install and Setup SVN on cPanel Server

Last modified: July 31, 2020
You are here:
Estimated reading time: 2 min

The Apache SVN is an open source revision control and software versioning system distributed under the Apache license, the Developers use this software to maintain the historical and current versions of files such as Source code, web pages, and documentation. Subversion is an open source version control system. It helps you keep track of a collection folders and files, at any time you can change, add or delete a file or folder that you manage with Subversion, you commit these changes to your Subversion repository.

Let’s discuss the installation steps of SVN server on a cPanel/WHM server. Before that, you need to make sure the following Prerequisites are installed on your server.

1) sqlite3 php module

2) Apache mod_dav module.

 

Installation

1) Install Subversion from source code is better in case of if you need the latest version of Subversion. Download and install Subversion by execute the following commands. You can check the latest version of Subversion on https://subversion.apache.org/download/

#cd /usr/local/src/

#wgethttp://mirror.fibergrid.in/apache/subversion/subversion-1.9.5.tar.gz

#cd subversion-1.9.5/

#./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/

You need to correct the “–with-apr-util=” the exact path. Look for the httpd-**(where stars are your script version) and update accordingly and run the configure, make and make install commands.

 

2) When using the EasyApache and WHM, we can’t just modify the Apache configuration file directly to include the Subversion modules. Instead of that, we need to use the Include, which you can find by browsing to the “Apache configuration” in WHM menu list. Where we need to use the Pre-main include, select the latest Apache version from the dropdown list and a text area will appear, where we can add the below entry 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

 

3) The best way is to use one repository per domain or subdomain. For example, consider our domain name is “example.com” and “example” is the cPanel username. Then first we need to add new virtual host for your repository:

#mkdir -p /etc/httpd/conf/userdata/std/2/example/example.com

On next step, we need to create the Subversion config file and copy the following to the svn.conf file. For every repository, you wish to create, add another <location> block.

#vi /etc/httpd/conf/userdata/std/2/example/example.com/svn.conf

<IfModule mod_dav_svn.c>

<Location /svn>

DAV svn

SVNPath /home/example/public_html/svn

AuthType Basic

AuthName “Example SVN”

AuthUserFile /home/example/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

Then create the actual repository files by following the below commands.

#su – example

#cd public_html

#svnadmin create svn

#chmod 775 -R svn

To add Subversion users, you can follow the below commands.

#/usr/local/apache/bin/htpasswd /home/example/public_html/passwd username

Enter Password when asked. Now you can go to http://example.com/svn to test your repository, this should ask for your user and password.

 

If you need any further help please do reach our support department.

Was this article helpful?
Dislike 0
Views: 8