Howto: Subversion with WebDAV and Websvn

Heute mal was auf Englisch:Â

After I searched this information for some hours today, here is it and I hope it is useful for someone.

This is how to integrate Subversion with Apache2, WebDAV and Websvn. The whole thing was done on debian, so you may have to adjust it a bit if you are working on a different platform. I assume you know what Subversion is - if you don’t, read the link.

First create your repositories and give it the appropiate rights. I use a new System-user for this purpose.
$Â su
# adduser --system svn
# cd ~svn
# svnadmin create myRepo
# chown -R svn:www-data *
# chmod -R 775 *Â

Then set up a new vhost in your apache-config (I think this is debian-specific, so you may have to adjust this)
# vi /etc/apache2/sites-enabled/svn

this is an example configuration I first found here:
<VirtualHost 123.123.123.123:443> Â Â Â
ServerAdmin bla@blubb.com   Â
ServerName svn.chief-architect.de   Â
DocumentRoot /var/www/svn   Â
LoadModule dav_module /usr/lib/apache2/modules/mod_dav.so   Â
LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so   Â
LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so   Â
SSLEngine On   Â
SSLCertificateFile /etc/apache2/ssl/apache.pem    Â
<location /svn> Â Â Â Â Â Â Â
Order allow,deny       Â
Allow from all       Â
DAV svn       Â
SVNParentPath /home/svn       Â
AuthzSVNAccessFile /etc/apache2/auth-files/public-svn-authzfile       Â
Satisfy Any       Â
Require valid-user       Â
AuthType Basic       Â
AuthName "chief-architect.de Subversion Repository" Â Â Â Â Â Â Â
AuthUserFile /etc/apache2/auth-files/dav_svn.passwd   Â
</location> Â Â Â
ErrorLog /var/log/apache2/error.log   Â
# Possible values include: debug, info, notice, warn, error, crit, Â Â Â
# alert, emerg. Â Â Â
LogLevel warn   Â
CustomLog /var/log/apache2/access.log combined
</VirtualHost>Â

Then we need to create the accessfile:
# vi /etc/apache2/auth-files/public-svn-authzfile
Some sample config that defines a group of developers that get read/write-access:[groups]
developers = philip
[myRepo:/]
@developers = rwÂ

Let’s add the user “philip”:
# touch /etc/apache2/auth-files/dav_svn.passwd
# chown www-data /etc/apache2/auth-files/dav_svn.passwd
# chmod 600 /etc/apache2/auth-files/dav_svn.passwd
# htpasswd -m /etc/apache2/auth-files/dav_svn.passwd philip
you will be prompted for a password and it will be stored md5-hashed.Â

Now the Subversion-Repository should be ready. So we test it:
# apache2ctl -k restart
No errors, I hope
# cd /root
# mkdir svntest
# cd svntest
# svn co https://[yourservername.here]/svn/myRepo
Enter your authentication data, when you are prompted and if no errors come up, your subversion-server is up and running. congratulations :)Â

Now we integrate websvn (a php-application that allowes to browse the repositories with your webbrowser; I used Version 2.0rc1):
# mkdir /var/www/svn
# cd /var/www/svn
download the websvn-code and unpack it to a folder called “websvn” then go on:
# cd websvn/include
# cp distconfig.inc config.inc
# vi config.inc
Change the following things:
$config->parentPath("/home/svn");
$config->useMultiViews();
$config->useAuthenticationFile("/etc/apache2/auth-files/public-svn-authzfile");

Then:
# cd ..
# cp wsvn.php ../
# cd ..
# vi wsvn.php
Change the following:
$locwebsvnhttp = "/websvn";
$locwebsvnreal = "/var/www/svn/websvn";

Then:
# vi .htaccess
Add:
Options MultiViews
DirectoryIndex wsvn.php index.html index.cgi index.pl index.php index.xhtml
Â

Then change the vhost-config:
# vi /etc/apache2/sites-enabled/svn
Add the following between right after the first </location>:
<location /wsvn/> Â Â Â Â Â Â Â
Order allow,deny  Â
A
llow from all       Â
DAV svn        Â
SVNParentPath /home/svn        Â
AuthzSVNAccessFile /etc/apache2/auth-files/public-svn-authzfile        Â
Satisfy Any       Â
Require valid-user       Â
AuthType Basic       Â
AuthName "chief-architect.de Subversion Repository" Â Â Â Â Â Â Â
AuthUserFile /etc/apache2/auth-files/dav_svn.passwd   Â
</location>

Then restart apache and hope that everything has gone well:
# apache2ctl -k restart

If there are no errors, point your browser to https://[yourServerName]/wsvn and you should see the websvn index-page, but without any repositories listet. Then go next to https://[yourServerName]/wsvn/myRepo. You should be asked for authentication. Enter the username and password you added before with the htpasswd-command. If all goes well, should now be able to browse your repository.Â

That’s it. I hope there are no big mistakes (but I fear there are because I wrote everything from memory). If you find some, leave a comment and I’ll see if I can correct it.

Â

Schlangenbeschwörer

Als Chief-Architect, der etwas auf sich hält, muss man natürlich immer die neuesten Technologien kennen und sei es auch nur um andere Architects oder Frickler mit seinem enormen Fachwissen und Buzzwords zu beeindrucken.

Im Zuge dessen habe ich mir vor einigen Tagen mal die öffentliche, kostenlose Beta von IBMs DB2 Version 9.1 (Viper) angeschaut. Killer-Feature dieser Version ist die Synergie (ich mag dieses Wort) von relationalen Datenbanken und XML. Dazu wurde ein neuer Attributtyp namens XML eingefügt, der XML-Daten hirarchisch (also nicht einfach als CLOB oder varchar) speichert. Anfragen an dieses Attribut kann man über XQUERY (von einigen wenigen Eingeweihten ausgesprochen als [ixquiehri]) und XPATH formulieren.

Schauen wir uns das im Folgenden also mal genauer an (Während der Splash-Screen der Steuerungszentrale läuft, kann man sogar noch einen Kaffee trinken. IBM denkt eben an alles. Enterprise-Software halt.)… (Read more klicken)

Read more