Subversion-1.4.6 & httpd-2.2.6
Par Ludo le dimanche 24 février 2008, 15:54 - Apache - Lien permanent
Un petit billet couvrant l'installation d'un subversion et une authentification au travers d'apache et subversion. Installation se basant sur subversion 1.4.6 et httpd 2.2.6.
Si vous rencontrez des problèmes de compilation, vérifiez bien vos dépendances, pensez aussi a renseigner votre fichier ld.so.conf en y ajoutant les lib des applis que vous istallez. On commence par Berkeley-BD ( ne pas prendre une version supérieure à 4.5.x (ie 4.6.x) :
# cd ~/work/ # wget http://download.oracle.com/berkeley-db/db-4.5.20.tar.gz # tar xvzf db-4.5.20.tar.gz # cd db-4.6.19/build_unix # sh ../dist/configure --prefix=/applis/db-4.5.20 # make && make install
Puis installation de neon (neon is an HTTP and WebDAV client library) utilisée lors de l'installation de subversion. Attention, pour cette version de subversion, il faut utiliser la version 0.25.5, les versions comme les 0.26.x ne fontionneront pas (en tout cas chez moi :) ).
# cd ~/work/ # wget http://www.webdav.org/neon/neon-0.25.5.tar.gz # tar xvzf neon-0.25.5.tar.gz # cd neon-0.25.5/ # ./configure --prefix=/applis/neon-0.25.5 \ --enable-shared
Puis apache 2.2.6 :
# cd ~/work/ # wget http://apache.crihan.fr/dist/httpd/httpd-2.2.6.tar.gz # tar xvzf httpd-2.2.6.tar.gz # cd httpd-2.2.6/ ./configure --prefix=/applis/httpd-2.2.6 \ --with-ssl=/applis/openssl \ --enable-modules=all \ --enable-mods-shared=all \ --with-included-apr \ --with-dbm=db45 \ --with-berkeley-db=/applis/db \ --enable-ssl # make && make install
Installation de subversion :
# cd ~/work/ # wget http://subversion.tigris.org/downloads/subversion-1.4.6.tar.bz2 # tar xvjf subversion-1.4.6.tar.bz2 # cd subversion-1.4.6/ ./configure --prefix=/applis/subversion-2.2.4 \ --with-apxs=/applis/httpd-2.2.6/bin/apxs \ --with-apr=/applis/httpd-2.2.6 \ --with-apr-util=/applis/apache \ --with-berkeley-db=/applis/db-4.5.20 \ --with-neon=/applis/neon-0.25.5 \ --without-jdk \ --without-jikes \ --without-swig \ --without-junit \ --enable-dso # make && make install
On créé le groupe et le user pour subversion :
# groupadd svn # useradd svn -c "SVN User" -g svn -d /home/svn/ -s /bin/false
Bon a ce niveau là, on a nos applicatifs installés, c'est déjà ca de fait. Au niveau d'apache, de nouveaux modules sont disponibles, modifier httpd.conf pour les prendre en compte nous nous en servirons.
LoadModule dav_module modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so
Côté subversion
On va commencer par créer notre repository :
# mkdir /home/svn # chown -R svn: /home/svn # svnadmin create /home/svn/moustik
Pour tester que cela fonctionne niveau subversion, on va faire un checkout et quelques tests bidons du repository en local :
$ mkdir ~/svn $ cd ~/svn/ $ svn checkout file:///home/svn/moustik Checked out revision 0.
On place un fichier “test1.txt” sur le repository :
$ echo "test1" > test1.txt $ svn import test1.txt file:///home/svn/cfengine/test1.txt -m "fichier test1.txt" Adding test1.txt Committed revision 1.
On se synchronise par rapoort au svn :
$ rm test1.txt $ svn update A test1.txt Updated to revision 1.
On modifie le fichier et on le commit :
$ echo "modif" >> test1.txt $ svn commit -m "une modification" Sending test1.txt Transmitting file data . Committed revision 2.
Authentification via apache
<VirtualHost *:80>
ServerName svn.plop.org
DocumentRoot /var/www/svn.moustik.org
DirectoryIndex index.php
CustomLog /var/log/httpd/svn.moustik.org.log combined
ErrorLog /var/log/httpd/svn.moustik.org_err.log
LogLevel warn
<Location /svn>
Order deny,allow
Allow from all
DAV svn
SVNParentPath /home/svn
AuthType Basic
Require valid-user
AuthName "SVN Plop"
AuthUserFile /home/svn-auth/auth-user.conf
AuthzSVNAccessFile /home/svn-auth/svn-auth.conf
</Location>
</virtualhost>
Quelques explications sur la configuration du vhost :
Pour la partie authentification, nous avons :
AuthType Basic Require valid-user AuthName "SVN Plop" AuthUserFile /home/svn-auth/auth-user.conf
Pour renseigner les login/password pour l'authentification :
# htpasswd -c /home/svn-auth/auth-user.conf toto New password: Re-type new password: Adding password for user toto
Pour la partie permission, nous avons :
AuthzSVNAccessFile /home/svn-auth/svn-auth.conf
Un exemple de fichier de configuration :
[moustik:/] * = rw [moustik:/configuration] ludo = rw * =
Dans cet exemple :
- Tout le monde à accès à la racine du repository moustik.
- Seul Ludo à accès au répertoire configuration
- A noter qu'il existe d'autres directives comme les groupes, etc.
Vous pouvez tester votre repository :
Avec un mauvais utilisateur :
- svn co http://svn.moustik.org/svn/moustik
Authentication realm: <http://svn.moustik.org:80> SVN moustik Password for 'bulk': Authentication realm: <http://svn.moustik.org:80> SVN moustik Username: bulk Password for 'bulk': Authentication realm: <http://svn.moustik.org:80> SVN moustik Username: bulk Password for 'bulk': svn: PROPFIND request failed on '/svn/moustik' svn: PROPFIND of '/svn/moustik': authorization failed (http://svn.moustik.org)
On s'authentifie :
# svn co http://svn.moustik.org/svn/moustik --username ludo Authentication realm: <http://svn.moustik.org:80> SVN moustik Password for 'ludo': A moustik/configuration A moustik/configuration2 Checked out revision 3.
Voilà de quoi mieux gérer vos fichiers de dev et de conf.
Commentaires