How to install Subversion on Plesk 8.1

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!

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

Thanks for this great tutorial. Helped me out where others (and official ones) failed =)

Thnak you far that great tutorial. But I’ve relly problems to secure my repositry from web acces. I only want to manage the reporitry on my server and don’t want people to view the files in it. If I add “Require valid-user” in my vhost.conf file, I get a Error 500 from my server.

@Steff, you have to put them in .htaccess not in vhost.conf file. Please look here: http://httpd.apache.org/docs/1.3/howto/htaccess.html
for details and how to manage this.

hello,

I did it like this, also the right order in loadmodule.con, but I get this error, when I stop apache2
Cannot load /usr/lib/apache2/mod_dav_svn.so into server: /usr/lib/apache2/mod_dav_svn.so: undefined symbol: svn_txdelta_to_svndiff2

I took svn 1.1.6, is this the Problem?

jos

Thank you very much for this great tutorial!! Saved me a lot of grey hairs.
P.S.: this works also with subversion 1.3.0

Leave a comment

(required)

(required)