Catégories
Gstreamer Open-source Systeme

Compiler GStreamer depuis les sources sous GNU/Linux

Edit: j’ai ajouté un script SHELL « qui fait tout pour vous » en fin de billet…

Voici une petite procédure pour compiler la dernière version du framework multimédia GStreamer tout en préservant la version installée depuis les dépôts officiels. La procédure a été validé sur une GNU/Linux Ubuntu 9.04 mais doit facilement être adaptable à d’autres distribution (pour une procèdure équivalente sous Mac OS X, vous pouvez lire ce billet).

GStreamer étant un framework, il se base sur de nombreuses librairies externes. Pour nous simplifier la tache, nous allons utiliser les dépôts pour l’installation de ces librairies:

sudo aptitude build-dep gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse bison flex git

Ensuite on récupère les dernières versions disponibles de GStreamer et de ses plugins:

mkdir ~/src
cd ~/src
wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.25.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.25.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-0.10.17.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.17.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-0.10.13.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-ffmpeg/gst-ffmpeg-0.10.8.tar.gz

On commence par la compilation de GStreamer (core). L’installation se fera dans le répertoire /opt/gstreamer/gstreamer-0.10.24:

tar zxvf gstreamer-0.10.25.tar.gz
cd gstreamer-0.10.25
./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

… puis les plugins « base »:

tar zxvf gst-plugins-base-0.10.25.tar.gz
cd gst-plugins-base-0.10.25
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

… puis les plugins « good »:

tar zxvf gst-plugins-good-0.10.17.tar.gz
cd gst-plugins-good-0.10.17
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

… puis les plugins « bad »:

tar zxvf gst-plugins-bad-0.10.17.tar.gz
cd gst-plugins-bad-0.10.17
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

… les plugins « ugly »:

tar zxvf gst-plugins-ugly-0.10.13.tar.gz
cd gst-plugins-ugly-0.10.13
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

… et enfin les plugins FFMPEG (streaming):

tar zxvf gst-ffmpeg-0.10.8.tar.gz
cd gst-ffmpeg-0.10.8
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

Puis on créé un lien symbolique entre le répertoire /opt/gstreamer/current et /opt/gstreamer/gstreamer-0.10.25. Ce lien nous permet d’avoir plusieur version de GStreamer sur notre système.

sudo cp /opt/gstreamer/gstreamer-0.10.25/lib/gstreamer-0.10.25/* /opt/gstreamer/gstreamer-0.10.25/lib/

sudo ln -s /opt/gstreamer/gstreamer-0.10.25/lib /opt/gstreamer/current

On teste enfin l’installation:

/opt/gstreamer/gstreamer-0.10.25/bin/gst-inspect –gst-plugin-path=/opt/gstreamer/current

Pour les plus faineant, voici un script sheel automatisant ces quelques taches

[shell]
#!/bin/sh

# A simple script to get/compile/install GStreamer

# Nicolas Hennion – GPL

#

# Remarks: the version will be installed in the /opt/gstreamer folder

# Change this to the latest version

GST_CORE=0.10.25

GST_BASE=0.10.25

GST_GOOD=0.10.17

GST_BAD=0.10.17

GST_UGLY=0.10.13

GST_FFMPEG=0.10.8

# Do not edit under this line

sudo aptitude build-dep gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse

sudo aptitude install bison flex git

if [ ! -e gstreamer-$GST_CORE.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-$GST_CORE.tar.gz

fi

if [ ! -e gst-plugins-base-$GST_BASE.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-$GST_BASE.tar.gz

fi

if [ ! -e gst-plugins-good-$GST_GOOD.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-$GST_GOOD.tar.gz

fi

if [ ! -e gst-plugins-bad-$GST_BAD.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-$GST_BAD.tar.gz

fi

if [ ! -e gst-plugins-ugly-$GST_UGLY.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-$GST_UGLY.tar.gz

fi

if [ ! -e gst-ffmpeg-$GST_FFMPEG.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gst-ffmpeg/gst-ffmpeg-$GST_FFMPEG.tar.gz

fi

sudo mkdir /opt/gstreamer

if [ ! -e gstreamer-$GST_CORE ]

then

tar zxvf gstreamer-$GST_CORE.tar.gz

cd gstreamer-$GST_CORE

./configure –prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

if [ ! -e gst-plugins-base-$GST_BASE ]

then

tar zxvf gst-plugins-base-$GST_BASE.tar.gz

cd gst-plugins-base-$GST_BASE

PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

if [ ! -e gst-plugins-good-$GST_GOOD ]

then

tar zxvf gst-plugins-good-$GST_GOOD.tar.gz

cd gst-plugins-good-$GST_GOOD

PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

if [ ! -e gst-plugins-bad-$GST_BAD ]

then

tar zxvf gst-plugins-bad-$GST_BAD.tar.gz

cd gst-plugins-bad-$GST_BAD

PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

if [ ! -e gst-plugins-ugly-$GST_UGLY ]

then

tar zxvf gst-plugins-ugly-$GST_UGLY.tar.gz

cd gst-plugins-ugly-$GST_UGLY

PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

if [ ! -e gst-ffmpeg-$GST_FFMPEG ]

then

tar zxvf gst-ffmpeg-$GST_FFMPEG.tar.gz

cd gst-ffmpeg-$GST_FFMPEG

PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

sudo cp /opt/gstreamer/gstreamer-$GST_CORE/lib/gstreamer-$GST_CORE/* /opt/gstreamer/gstreamer-$GST_CORE/lib/

sudo ln -s /opt/gstreamer/gstreamer-$GST_CORE/lib /opt/gstreamer/current

/opt/gstreamer/gstreamer-$GST_CORE/bin/gst-inspect –gst-plugin-path=/opt/gstreamer/current

[/shell]

Catégories
Open-source Reseau Systeme

Installation de NRPE depuis les sources

Afin de disposer de la dernière version de NRPE (le plugin pour superviser vos serveurs GNU/Linux, BSD ou Mac OS X sous Nagios), il est parfois nécessaire de la compiler depuis les sources. Voici donc une simple procédure pour installer NRPE 2 et les plugins Nagios « standards » sous une distribution GNU/Linux.

Récupération des sources

Nous partons, bien sûr, sur l’hypothèse ou votre machine cible (c’est à dire celle ou vous aller compiler NRPE) dispose des logiciels de développement de base (configure, make, gcc…).

Si votre machine dispose d’un accès internet, vous pouvez saisir les commandes suivantes (en remplacent les numéros de versions par les dernières disponibles):

wget http://surfnet.dl.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz

wget http://heanet.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz

Préalablement à l’installation de NRPE, il faut créer un utilisateur ‘nagios’ sur votre machine:

adduser nagios

Pour des raisons de sécurité, il est préférable que cet utilisateur n’ait pas de shell:

vipw

Remplacer la ligne:

nagios:x:500:500::/home/nagios:/bin/bash

Par:

nagios:x:500:500::/home/nagios:/bin/noshell

Installation de NRPE

On lance la fameuse séquence:

tar zxvf nrpe-2.12.tar.gz

cd nrpe-2.12

./configure

make all

make install

Lors de la compilation il est possible qu’il manque des dépendances. Par exemple, si vous avez le message suivant:

checking for SSL headers… configure: error: Cannot find ssl headers

Il faut installer les librairies SSL (libssl-dev sous Ubuntu):

apt-get install libssl-dev

Installation des plugins Nagios standards

Pareil que miguel…:

tar zxvf nagios-plugins-1.4.13.tar.gz

cd nagios-plugins-1.4.13

./configure

make install

Puis une initialisation du script de configuration (/usr/local/nagios/etc/nrpe.conf):

mkdir /usr/local/nagios/etc

cp sample-config/nrpe.cfg /usr/local/nagios/etc

Correction des droits sur les fichiers

De base, les plugins sont installés avec les droits de l’utilisateur qui à lancé la compilation. Pour être sûr que NRPE puisse lancer les plugins, on doit saisir la commande suivante:

chown -R nagios:nagios /usr/local/nagios/

Lancement automatique au démarrage

Un script standard est fourni dans les sources:

cp init-script /etc/init.d/nrpe

chmod 755 /etc/init.d/nrpe

Configuration de NRPE

Sous GNU/Linux, suivre ce tutoriel, sous BSD et Mac OS X, suivre celui là.