====== Subversion ====== ===== Tutorials & Anleitungen im Netz ===== http://voetterle.de/2009/06/05/subversion-server-unter-debian-lenny-einrichten/ http://wiki.ubuntuusers.de/Subversion ===== APT-Pakete ===== Apache & SSL muss schon installiert & aktiviert sein! sudo apt-get install subversion libapache2-svn ===== Konfiguration ===== Erstellen eines neuen Verzeichnisses und setzen der Benutzerrechte für den Apachen: sudo mkdir /var/svn sudo chown -R www-data:www-data /var/svn Hinzufügen zum Apachen: nano /etc/apache2/sites-available/svn mit Inhalt: ServerAdmin webmaster@localhost DocumentRoot /var/www Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all DAV_SVN konfiguration: /etc/apache2/mods-available/dav_svn.conf Mit dem Inhalt: # dav_svn.conf - Example Subversion/Apache configuration # # For details and further options see the Apache user manual and # the Subversion book. # # NOTE: for a setup with multiple vhosts, you will want to do this # configuration in /etc/apache2/sites-available/*, not here. # ... # URL controls how the repository appears to the outside world. # In this example clients access the repository as http://hostname/svn/ # Note, a literal /svn should NOT exist in your document root. # 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/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 and , 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'). # Require valid-user # SSLRequireSSL Dann die Aktivierung des Moduls und ein Neustart des Apachen: sudo a2enmod dav_svn sudo /etc/init.d/apache2 restart ==== Zugriffe auf die Repositories feiner erlauben/verhindern ==== Für eine etwas feiner Einstellung der Zugriffsrechte ist es nötig in der obigen Konfigurationsdatei in der Zeile # To enable authorization via mod_authz_svn #AuthzSVNAccessFile /etc/apache2/dav_svn.authz das # zu entfernen. Danach die entsprechende Datei mit z.B. sudo nano /etc/apache2/dav_svn.authz erstellen bzw. bearbeiten. In dieser sollte etwa folgender Inhalt sein: [groups] Admin = balserr Entwickler1 = lilli, chris Entwickler2 = boris, gerrit # Standardzugriffsrecht für alle Projekte # greift immer da wo nichts spezifischeres angelegt wurde # hier: # [/] -> root des Repository # * = -> Leserechte für alle entziehen # * = r -> Leserechte für alle setzen # @Admin = rw -> Schreib- und Leserechte für die Gruppe Admin [/] * = @Admin = rw # Spezielle Zugriffsregelung für einzelne Projekte # Projekt1 # Gruppe Entwickler1 hat Lese- und Schreibrechte # Gruppe Entwickler2 hat nur Leserechte # User boris aus Gruppe Entwickler2 bekommt Lese- und Schreibrechte [/projekt1] @Entwickler1 = rw @Entwickler2 = r boris = rw # Projekt2 # Gruppe Entwickler1 hat Lese- und Schreibrechte # Gruppe Entwickler2 hat keine Rechte # User gerrit aus Gruppe Entwickler2 bekommt Leserechte [/projekt2] @Entwickler1 = rw @Entwickler2 = gerrit = r Der Zugriff auf die einzelnen Repositories erfolgt jetzt zum einen über die angelegten DAV User, nur diese können überhaupt zugreifen. Welcher User auf welches Repository Zugriff hat, regelt die eben angelegte Datei. Die entsprechenden Dummies oben gerrit, boris, Entwickler1 etc. müssen natürlich angepasst werden. Nicht vergessen den Apache neu zu starten sudo /etc/init.d/apache2 restart ===== Anlegen von Benutzern ===== Benutzer anlegen mit: sudo htpasswd /etc/apache2/dav_svn.passwd BENUTZERNAME ===== Anlegen eines SVN-Repos ===== sudo svnadmin create /var/svn/test sudo chown -R www-data:www-data /var/svn/test und schon hat man ein neues Repo mit dem Namen "test" erstellt, dieses lässt sich nun mit folgender Anweisung "auschecken": svn co https://kvfg.info/svn/test/ Aber auch nur, wenn man Benutzernamen und Passwort weiß.