How to install Subversion on Plesk 8.1

Tue 31 July 2007

I will try to explain step by step how I installed Subversion on a Virtual Private Server wich runs Plesk 8.1.1 as control panel and Suse Linux 9.3 as operating system:

First step is to download subversion package, now the latest version is 1.4.4. It is very nice that they offer also a package with dependencies. So, we download:

subversion-1.4.4.tar.gz

subversion-deps-1.4.4.tar.gz

Unpack them:

# tar -zxvf subversion-1.4.4.tar.gz
# tar -zxvf subversion-deps-1.4.4.tar.gz

The second command will include the dependencies in the same directory with main subversion package.

We compile and install the subversion package and dependencies:

# cd subversion-1.4.4
# ./autogen.sh
# ./configure
# make
# cp /etc/apache2/sysconfig.d/loadmodule.conf /etc/apache2/httpd2-prefork.conf
# make install
# cp /etc/apache2/httpd2-prefork.conf /etc/apache2/sysconfig.d/loadmodule.conf

Now, checking the differences between these two files we have:

# diff /etc/apache2/sysconfig.d/loadmodule.conf /etc/apache2/httpd2-prefork.conf
30a31,32

> LoadModule dav_svn_module /usr/lib/apache2/mod_dav_svn.so
> LoadModule authz_svn_module   /usr/lib/apache2/mod_authz_svn.so

so, we can see that already the modules are in the right place.

Edit /etc/ld.so.conf to include /usr/lib and /usr/lib/apache2 and then run:

# /sbin/ldconfig

IMPORTANT: in /etc/apache2/sysconfig.d/loadmodule.conf we need also:

LoadModule dav_module   /usr/lib/apache2-prefork/mod_dav.so

before the previous two lines. dav_module has to appear before dav_svn_module in file. If you don’t have this line before, you will see next message when you try to restart apache server:

Cannot load /usr/lib/apache2/mod_dav_svn.so into server: /usr/lib/apache2/mod_dav_svn.so: undefined symbol: dav_xml_get_cdata

so, my file looks like this (only last three important lines):

[...]
LoadModule dav_module   /usr/lib/apache2-prefork/mod_dav.so
LoadModule dav_svn_module     /usr/lib/apache2/mod_dav_svn.so
LoadModule authz_svn_module   /usr/lib/apache2/mod_authz_svn.so

Edit /etc/sysconfig/apache2 and add: “dav mod_dav_svn mod_authz_svn” to APACHE_MODULES section. My specific section is like this:

APACHE_MODULES="mod_perl access actions alias auth auth_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl   userdir php4 php5 /usr/lib/apache2-prefork/mod_frontpage.so python   suexec rewrite dav mod_dav_svn mod_authz_svn"

Now is time to create our repository and set the correct owner and group for it:

# svnadmin create /home/svn
# chown -R apacheuser:apachegroup /home/svn

If you edit /srv/www/vhosts/domain.com/conf/httpd.include and add at the end something, Plesk will remove your changes.

So, we need to create a new file vhost.conf and to use this file. I will create /srv/www/vhosts/domain.com/conf/vhost.conf and I will put inside:

<Location /svn>
DAV svn
SVNPath /home/svn
</Location>

for a subdomain the file has to be in /srv/www/vhosts/domain.com/subdomains/NAME/conf

Now, you need to tell Plesk to update it’s information. You have to run:

# /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain.com

this will configure plesk only for one single domain, in this case domain.com

If you want to configure it for all sites run:

# /usr/local/psa/admin/bin/websrvmng -a

Restart apache web server:

# /usr/sbin/apache2ctl stop
# /usr/sbin/apache2ctl start

Check the repository:

http://domain.com/svn

So, it seems that it is working, we can see:

Revision 0: /
Powered by Subversion version 1.4.4 (r25188).

I hope that also for you. :))

Next step is to restrict the access to our repository to give access only for some users:

DAV svn
SVNPath /home/svn/
AuthType Basic
AuthName “Private Repository”
AuthUserFile /etc/svn_auth_file
Require valid-user

We can add first user which is able to access our repository (use htpasswd2 if you have apache2):

# htpasswd -cm /etc/svn_auth_file firstuser

-m means that we want to use MD5 encryption for passwords

To add the second user (don’t use -c option, it is used only the first time to create svn_auth_file):

# htpasswd -m /etc/svn_auth_file seconduser

Bye!