Svn

From A-Eskwiki
Jump to: navigation, search

Op de vm-svn staan alle svn-repos zoals bijv de webcie-svn.

Svn en websvn installeren

Subversion

Om op een machine met yum subversion te installeren doe je

yum install subversion

Dit zorgt voor oa een bestand /etc/httpd/conf.d/subversion.conf. Hierin horen alle repositories geconfigureert te staan. De repositories staan standaard in /var/www/svn/.

IPA/Kerberos

Installeer svn, websvn en de bijbehorende modules om het goed met kerberos te laten werken:

yum install subversion websvn mod_auth_kerb mod_dav_svn

Zorg ervoor dat het bestand /etc/httpd/conf.d/websvn.conf er als volgt uit ziet:

Alias /websvn /usr/share/websvn/

<Directory /usr/share/websvn/>
   Options MultiViews Indexes FollowSymLinks Includes ExecCGI
   DirectoryIndex wsvn.php
   AuthType Kerberos
   AuthName "Kerberos Login"
   KrbMethodNegotiate On
   KrbMethodK5Passwd On
   KrbAuthRealms A-ESKWADRAAT.NL
   Krb5KeyTab /etc/httpd/krb5.keytab
   Require valid-user
</Directory>

en restart de httpd:

service httpd restart

Zorg er nu voor dat je svn-server met kerberos-credentials kan gebruiken. Maak in de ipaserver de service HTTP/"svnserver" aan. Voer dan op de svnserver het volgende uit:

ipa-getkeytab -s <ipa-server> -p HTTP/<svnserver> -k /etc/httpd/krb5.keytab
chown apache:apache /etc/httpd/krb5.keytab

Maak de map /var/lib/svn aan en zet de selinux-context goed:

mkdir /var/lib/svn
restorecon -Rvv /var/lib/svn

LDAP

Installeer svn, websvn en de bijbehorende modules om het goed met kerberos te laten werken:

yum install subversion websvn mod_authz_ldap

Zorg ervoor dat het bestand /etc/httpd/conf.d/websvn.conf er als volgt uit ziet:

Alias /websvn /usr/share/websvn/

<Directory /usr/share/websvn/>
   Options MultiViews Indexes FollowSymLinks Includes ExecCGI
   DirectoryIndex wsvn.php
   AuthType Basic
   AuthBasicProvider ldap
   AuthLDAPURL ldap://ldap/ou=mensjes,ou=accounts,dc=a-eskwadraat,dc=nl?uid
   AuthName 'WebSVN'
   Require valid-user
</Directory>

en restart de httpd:

service httpd restart

Maak de map /var/lib/svn aan en zet de selinux-context goed:

mkdir /var/lib/svn
restorecon -Rvv /var/lib/svn

Nieuwe repo toevoegen

Om een repo toe te voegen voeg je aan het bestand /etc/httpd/conf.d/subversion.conf het volgende toe:

<Location /websvn/wsvn/*reponaam*>
        Require user user1@AESKWADRAAT user2@AESKWADRAAT ...
</Location>

en voeg je aan /etc/httpd/conf.d/subversion.conf toe

<Location /svn/*reponaam*>
  DAV svn
  SVNPath /var/lib/svn/*reponaam*
  Options MultiViews Indexes FollowSymLinks Includes ExecCGI
  AuthType Kerberos
  AuthName "Kerberos Login"
  KrbMethodNegotiate On
  KrbMethodK5Passwd On
  KrbAuthRealms AESKWADRAAT
  Krb5KeyTab /etc/httpd/krb5.keytab
  Require user user1@AESKWADRAAT ...
</Location>

en voor ldap

<Location /svn/*reponaam*>
  DAV svn
  SVNPath /var/lib/svn/*reponaam*
  Options MultiViews Indexes FollowSymLinks Includes ExecCGI
  AuthType Basic
  AuthBasicProvider ldap
  AuthLDAPURL ldap://ldap/ou=mensjes,ou=accounts,dc=a-eskwadraat,dc=nl?uid
  AuthName 'WebSVN'
  Require ldap-group cn=...
</Location>

en reload httpd

service httpd reload

Maak nu de nieuwe repo aan:

cd /var/lib/svn
svnadmin create *repodir*

Zet ook de user en de groep van de repo goed.

Zorg er nu voor dat de repo in het websvn overzicht staat. Voeg hiervoor toe aan /etc/websvn/config.php de volgende regel:

$config->addRepository("reponaam", "file:///var/lib/svn/repodir");

SVN Checkout maken

Om nu een checkout van een repository *reponaam* te maken voer je het volgende uit:

svn co http://*svnserver*/svn/*reponaam*