Erforderliche Pakete
Zunächst wird Subversion, WebSVN und das zugehörige Apache Modul libapache2-svn
installiert.
1 |
apt-get install subversion libapache2-svn websvn |
Bei der Frage, ob WebSVN konfiguriert wird, bestätigen wir, ebenso die automatische Apache-Konfiguration. Als Pfadangaben wird /var/lib/svn
jeweils üernommen.
Repository
Erst wird ein entsprechendes Verzeichnis erstellt.
1 |
mkdir /var/lib/svn |
Darin wird dann ein leeres Subversion-Repository erzeugt.
1 |
svnadmin create /var/lib/svn/<repository1> |
Im Anschluss werden die Dateiberechtigungen gesetzt, damit Apache auf das Repository zugreifen kann.
1 |
chown -R www-data /var/lib/svn |
Die Datei /var/lib/svn/<repository1>/conf/svnserve.conf
wird bearbeitet, hierbei werden die Kommentarzeichen bei folgenden drei Zeilen entfert:
1 2 3 |
anon-access = none auth-access = write password-db = passwd |
In der Datei /var/lib/svn/<repository1>/conf/passwd
werden die Benutzer hinterleget.
1 2 |
<benutzer1> = <passwort> <benutzer2> = <passwort> |
WebSVN
Benutzer und Passwort…
1 |
htpasswd -cm /etc/apache2/dav_svn.passwd <benutzername> |
Benutzer dürfen lesen und schreiben, jeder andere kann lesend zugreifen. Die Datei /etc/apache2/dav_svn.authz
wie folgt erstellen:
1 2 3 4 |
[/] * = r <benutzer> = rw <benutzer> = rw |
Die Konfiguration des Apache-Moduls wird unter /etc/apache2/mods-available/dav_svn.conf
angepasst.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
<Location /svn> # Uncomment this to enable the repository DAV svn # Set this to the path to your repository SVNPath /var/lib/svn # Alternatively, use SVNParentPath if you have multiple repositories under # under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...). # You need either SVNPath and SVNParentPath, but not both. #SVNParentPath /var/lib/svn # Access control is done at 3 levels: (1) Apache authentication, via # any of several methods. A "Basic Auth" section is commented out # below. (2) Apache <Limit> and <LimitExcept>, also commented out # below. (3) mod_authz_svn is a svn-specific authorization module # which offers fine-grained read/write access control for paths # within a repository. (The first two layers are coarse-grained; you # can only enable/disable access to an entire repository.) Note that # mod_authz_svn is noticeably slower than the other two layers, so if # you don't need the fine-grained control, don't configure it. # Basic Authentication is repository-wide. It is not secure unless # you are using https. See the 'htpasswd' command to create and # manage the password file - and the documentation for the # 'auth_basic' and 'authn_file' modules, which you will need for this # (enable them with 'a2enmod'). AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd # To enable authorization via mod_authz_svn AuthzSVNAccessFile /etc/apache2/dav_svn.authz # The following three lines allow anonymous read, but make # committers authenticate themselves. It requires the 'authz_user' # module (enable it with 'a2enmod'). <LimitExcept GET PROPFIND OPTIONS REPORT> Require valid-user </LimitExcept> </Location> |
Los gehts…
Subversion starten und die Apachekonfiguration neu laden.
1 2 |
svnserve -d -r /var/lib/svn /etc/init.d/apache2 force-reload |
Der Zugriff auf WebSVN erfolgt über http://url-oder-ip-des-svn-servers/websvn.
Soll Subversion nach einem Reboot nicht von Hand gestartet werden, kann folgender Cronjob helfen:
1 |
@reboot svnserve -d -r /var/lib/svn |