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-authzfileSome 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.passwdyou will be prompted for a password and it will be stored md5-hashed.Â
# 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
Now the Subversion-Repository should be ready. So we test it:
# apache2ctl -k restartNo errors, I hope
# cd /rootEnter your authentication data, when you are prompted and if no errors come up, your subversion-server is up and running. congratulations :)Â
# mkdir svntest
# cd svntest
# svn co https://[yourservername.here]/svn/myRepo
Now we integrate websvn (a php-application that allowes to browse the repositories with your webbrowser; I used Version 2.0rc1):
# mkdir /var/www/svndownload the websvn-code and unpack it to a folder called “websvn” then go on:
# cd /var/www/svn
# cd websvn/includeChange the following things:
# cp distconfig.inc config.inc
# vi config.inc
$config->parentPath("/home/svn");
$config->useMultiViews();
$config->useAuthenticationFile("/etc/apache2/auth-files/public-svn-authzfile");
Then:
# cd ..Change the following:
# cp wsvn.php ../
# cd ..
# vi wsvn.php
$locwebsvnhttp = "/websvn";
$locwebsvnreal = "/var/www/svn/websvn";
Then:
# vi .htaccessAdd:
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/svnAdd the following between right after the first </location>:
<location /wsvn/> Â Â Â Â Â Â Â
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>
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.
Â




