Setting up subversion for multiple repositories on a Plesk/Ubuntu VServer
Setting up a SVN server on an Ubuntu Vserver running Plesk is smooth like butter. Mmmh, butter… Just for future reference, i’m going to explain it here.
Update: Configuration of basic authentication is included now.
First, install subversion and the Apache library with the command
sudo apt-get install subversion libapache2-svn
Next, enter the Subversion/Apache configuration into the vhost.conf file of the respective domain, e.g. /var/www/vhosts/[DOMAIN NAME]/conf/vhost.conf. This file contains all the important Apache stuff for the subdomain.
<Location /svn>
DAV svn
SVNParentPath /var/www/vhosts/[DOMAIN NAME]/svn
# The following three lines allow anonymous read, but make
# committers authenticate themselves.
<LimitExcept GET PROPFIND OPTIONS REPORT>
AuthType Basic
AuthName "SVN Authorization Realm"
AuthUserFile /var/www/vhosts/[DOMAIN NAME]/svn/svnUsers.passwd
Require valid-user
</LimitExcept>
</Location >
What is left is to create an example repository, restart Apache
cd /var/www/vhosts/[DOMAIN NAME]
mkdir svn
svnadmin create svn/test
chown -R www-data:www-data svn/
sudo /etc/init.d/apache2 restart
and to test it from your home computer
svn co http://www.[DOMAIN NAME]/svn/test
To allow you – and only you – to commit new files, authentication has to be configured. Run the following command on the the server, using your local user name for convenience:
htpasswd -c /var/www/vhosts/[DOMAIN NAME]/svn/svnUsers.passwd [USERNAME]
You will be prompted for a password. Commiting new files and directories should work now as well. And that’s pretty much it!
To allow only authenticated users to checkout the repository, remove both lines containing the “LimitExcept” from the vhost.conf file. Another excellent explanation of the setup process is to be found here.
Tags:english linux tech webserver | Filed on September 16th, 2008 | 5 Comments »
one correction, I think you meant:
svnadmin create var/www/vhosts/[DOMAIN NAME]/svn/test
(instead of svn)
Sure did! Thanks for pointing out that mistake.
Nice clear instructions thankyou!!! (note: I have a slightly different setup where instead of the vhosts file I had to change the file /etc/apache2/sites-available/[DOMAIN NAME].conf) but everything turned out perfectly.
thx! That was exactly what I’ve been lookin for.
Really nice tutorial.
First it didn’t worked, but than I found out, that ich have to run:
/usr/local/psa/admin/bin/websrvmng -a -v
before restarting the apache. After that it worked. Maybe this is a usefull information for someone…