My mission was install subversion on our server withour breaking cpanel. After so much googling I was able to do it. It took me like a week to figure out a method which will work without any issues on cpanel. The main issue was cpanel still doesn’t support apache 2 series. They do have support on edge version but it is highly unstable and doesn’t compile all the needed modules for php. In apache 1.3 the support for mod_dav is not very good. The only alternative for subversion was to use apache 2 series. So I started digging for articles.
I found there is a method to install both apache 1.3 and apache 2 together. Only thing is we have to use another port than 80 for apache 2. Let me go step by step like how I installed subversion.
1. Install subversion : This was really easy on centos. I just have to use yum and it does it all.
yum install subversion
This will install all libraries needed for subversion to work. Sometimes you may come across an issue with perl-uri. Just Google for “perl uri rpm” and you can download an install the same. In my case I had to download and install.
rpm -ivh perl-URI-1.35-2.2.noarch.rpm
2. The next thing was to create a repository.
cd /var/ mkdir -p repo/source/ svnadmin create /var/repo/source
With above commands I created a subversion repo named source. You can check inside the directory if lot of files are created. If created subversion works fine ;-).
3. Now we can proceed with apache 2 installation. I choosed apache 2.0.59
./configure --prefix=/usr/local/apache2 --with-port=2080 --enable-dav --enable-dav-fs --enable-proxy --enable-rewrite --enable-so make make install /usr/local/apache2/bin/apachectl start
Apache2 installed at port 2080 with dav , proxy and rewrite and started so simple ;-).
4. Now we have to compile mod_svn for apache 2. For this I had to download the source of subversion. Please check the version of subversion installed. You can check with the help of yum.
yum info subversion
Next download the same of subversion source and you need to compile mod_svn.
./configure --with-apxs=/usr/local/apache2/bin/apxs make make install
Now mod_svn is installed and activated on apache2. We can configure apache 2 to serve svn files with the help of mod_dav.
5. Configure apache 2 for svn. To do this I had to change the settings httpd.conf of apache 2. This file will be located here /usr/local/apache2/conf/httpd.conf
<location> DAV svn SVNPath /var/repo/source </location>
Restart apache2 once you made the above changes. Now you should be able to see the svn files from this url http://localhost:2080/svn/. You should be able to see the subversion files at revision 0. There is will be nothing in it as we have not added any files.
6. Now we have add proxy to apache 1.3 so that we can internally proxy the files between apache 2 and apache 1. You can download the source of currently installed apache 1.3 or you can find the same in /home/installd/buildapache/apache_1.3.xx/src/modules/proxy
Just goto that directory and run this command
/usr/local/apache/bin/apxs -i -c *.c
That will install mod_proxy to apache 1.3
7. You have add this setting to apache 1.3 conf file to proxy the http://localhost:2080/svn/ in standard port 80 of some website.
Add these line to any virtual host present in the conf file.
ProxyRequests Off ProxyPass / http://locahost:2080/svn
I had added for the virtual host svn.imthi.com.
You can view my subversion at http://svn.imthi.com/ username : guest and password : guest.
All done. If you wish add authentication you can Google on how to add simple http authentication. You can even add policies if you want. The final setting should look something like this with authentication and polices
<location> DAV svn SVNPath /var/repo/source AuthzSVNAccessFile /var/repo/conf/svnpolicy AuthType Basic AuthName "Imthiaz Subversion repository" AuthUserFile /var/repo/conf/svnusers Require valid-user </location>
For this svn book will be of great use. Have fun …!!! 😉