Einrichten von Subversion

Hinweis:
Diese Seite gibt meinen Wissensstand von ca. 2014 wieder und sollte heutzutage nicht mehr als Blaupause für das Anlegen eines Fileservers genutzt werden. Für eine Anleitung, die erst später veraltet sein wird, bitte die übergeordnete Seite betrachten. ;-)

Das Einrichten von Subversion ist jetzt relativ einfach. Zunächst wird wieder das entsprechende Paket installiert:

# pacman -S subversion

Danach wird wieder /etc/httpd/conf/httpd.conf editiert:

# vi /etc/httpd/conf/httpd.conf

<Location /svn>
    DAV svn
    SVNParentPath /mnt/svn
    SVNListParentPath On

    AuthName "My svn repository"
    AuthType Basic
    AuthUserFile /etc/httpd/conf/auth_file
    Require valid-user
</Location>

Mit SVNParentPath weisen wir das SVN-Modul an, alle im genannten Verzeichnis befindlichen Repositories zur Verfügung zu stellen. Damit spart man sich das Anpassen der Konfiguration, wenn mal ein Repository hinzukommt oder wegfällt. Die Option SVNListParentPath bewirkt, dass beim Aufrufen von https://filebox/svn/ eine Liste der verfügbaren Repositories angezeigt wird. Andernfalls gibt es eine Fehlermeldung und man muss den kompletten URL inklusive Repository-Name angeben.

Damit das Ganze funktioniert müssen noch die richtigen Module aktiviert werden.

LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so

Jetzt noch den Pfad anlegen und ein Beispiel-Repository erstellen:

# mkdir /mnt/svn
# chown felix:users /mnt/svn
# chmod 700 /mnt/svn/
# logout
$ cd /mnt/svn/
$ svnadmin create test
$ su -
# systemctl restart httpd.service

Jetzt noch ein kurzer Test vom Desktop-PC aus...

$ svn co https://192.168.2.101/svn/test
Error validating server certificate for 'https://192.168.2.101:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
 - The certificate hostname does not match.
Certificate information:
 - Hostname: felix
 - Valid: from Aug  9 19:27:07 2014 GMT until Aug  9 19:27:07 2015 GMT
 - Issuer: home, Bad Homburg, Hessen, DE
 - Fingerprint: 8C:E6:C1:A1:D8:69:D3:1D:6A:86:07:1E:7B:6E:67:BA:3B:80:49:90
(R)eject, accept (t)emporarily or accept (p)ermanently? p
Authentication realm:  My svn repository
Password for 'felix': ********


-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <https://192.168.2.101:443> My svn repository

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/felix/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
Checked out revision 0.
$ cd test/
$ echo "Hello, World!" > hello.txt
$ svn add hello.txt
A         hello.txt
$ svn ci -m "Erster Check-in!"
Adding         hello.txt
Transmitting file data .
Committed revision 1.
$ rm hello.txt
$ svn up
Updating '.':
Restored 'hello.txt'
At revision 1.
$ cat hello.txt
Hello, World!

Sieht doch prima aus. Naja, bis auf das "Your password can only be stored to disk unencrypted!". Die Dokumentation spricht, dass man dafür gnome-keyring und kwallet nutzen kann. Alternativ legt man sich ein verschlüsseltes Home-Verzeichnis zu, was ohnehin sinnvoll ist, weil man die Arbeitskopie ja auch irgendwo liegen haben muss. ;-)


Zurück zur Hauptseite