Table des matières
Niveau : Admin Junior | Numéro de la Leçon | Dernière Modification |
---|---|---|
2/4 | <progrecss 2/12 style=inline /> | 2020/01/30 03:28 |
Gestion des Paquets
Compiler à partir des sources
Historiquement il était nécessaire d'installer un logiciel à partir de ses fichiers sources.
Pour comprendre ce qui est la compilation d'un logiciel, commencez par télécharger le logiciel hello :
root@debian:~# wget http://www.linuxelearning.com/downloads/file/hello-2.1.1.tar.gz
Ensuite désarchivez le logiciel :
root@debian:~# tar xvf hello-2.1.1.tar.gz hello-2.1.1/ hello-2.1.1/intl/ hello-2.1.1/intl/ChangeLog hello-2.1.1/intl/Makefile.in hello-2.1.1/intl/config.charset hello-2.1.1/intl/locale.alias hello-2.1.1/intl/ref-add.sin hello-2.1.1/intl/ref-del.sin hello-2.1.1/intl/gmo.h hello-2.1.1/intl/gettextP.h hello-2.1.1/intl/hash-string.h hello-2.1.1/intl/plural-exp.h hello-2.1.1/intl/eval-plural.h hello-2.1.1/intl/os2compat.h hello-2.1.1/intl/libgnuintl.h hello-2.1.1/intl/loadinfo.h hello-2.1.1/intl/bindtextdom.c hello-2.1.1/intl/dcgettext.c hello-2.1.1/intl/dgettext.c hello-2.1.1/intl/gettext.c hello-2.1.1/intl/finddomain.c hello-2.1.1/intl/loadmsgcat.c hello-2.1.1/intl/localealias.c hello-2.1.1/intl/textdomain.c hello-2.1.1/intl/l10nflist.c hello-2.1.1/intl/explodename.c hello-2.1.1/intl/dcigettext.c hello-2.1.1/intl/dcngettext.c hello-2.1.1/intl/dngettext.c hello-2.1.1/intl/ngettext.c hello-2.1.1/intl/plural.y hello-2.1.1/intl/plural-exp.c hello-2.1.1/intl/localcharset.c hello-2.1.1/intl/localename.c hello-2.1.1/intl/osdep.c hello-2.1.1/intl/os2compat.c hello-2.1.1/intl/intl-compat.c hello-2.1.1/intl/plural.c hello-2.1.1/intl/VERSION hello-2.1.1/po/ hello-2.1.1/po/Makefile.in.in hello-2.1.1/po/Makevars hello-2.1.1/po/remove-potcdate.sin hello-2.1.1/po/quot.sed hello-2.1.1/po/boldquot.sed hello-2.1.1/po/en@quot.header hello-2.1.1/po/en@boldquot.header hello-2.1.1/po/insert-header.sin hello-2.1.1/po/Rules-quot hello-2.1.1/po/POTFILES.in hello-2.1.1/po/hello.pot hello-2.1.1/po/ca.po hello-2.1.1/po/da.po hello-2.1.1/po/de.po hello-2.1.1/po/de_DE.po hello-2.1.1/po/el.po hello-2.1.1/po/eo.po hello-2.1.1/po/es.po hello-2.1.1/po/et.po hello-2.1.1/po/fi.po hello-2.1.1/po/fr.po hello-2.1.1/po/gl.po hello-2.1.1/po/he.po hello-2.1.1/po/hr.po hello-2.1.1/po/hu.po hello-2.1.1/po/id.po hello-2.1.1/po/it.po hello-2.1.1/po/ja.po hello-2.1.1/po/ko.po hello-2.1.1/po/lv.po hello-2.1.1/po/nb.po hello-2.1.1/po/nl.po hello-2.1.1/po/nn.po hello-2.1.1/po/pl.po hello-2.1.1/po/pt.po hello-2.1.1/po/pt_BR.po hello-2.1.1/po/ru.po hello-2.1.1/po/sk.po hello-2.1.1/po/sl.po hello-2.1.1/po/sv.po hello-2.1.1/po/tr.po hello-2.1.1/po/uk.po hello-2.1.1/po/ca.gmo hello-2.1.1/po/da.gmo hello-2.1.1/po/de.gmo hello-2.1.1/po/de_DE.gmo hello-2.1.1/po/el.gmo hello-2.1.1/po/eo.gmo hello-2.1.1/po/es.gmo hello-2.1.1/po/et.gmo hello-2.1.1/po/fi.gmo hello-2.1.1/po/fr.gmo hello-2.1.1/po/gl.gmo hello-2.1.1/po/he.gmo hello-2.1.1/po/hr.gmo hello-2.1.1/po/hu.gmo hello-2.1.1/po/id.gmo hello-2.1.1/po/it.gmo hello-2.1.1/po/ja.gmo hello-2.1.1/po/ko.gmo hello-2.1.1/po/lv.gmo hello-2.1.1/po/nb.gmo hello-2.1.1/po/nl.gmo hello-2.1.1/po/nn.gmo hello-2.1.1/po/pl.gmo hello-2.1.1/po/pt.gmo hello-2.1.1/po/pt_BR.gmo hello-2.1.1/po/ru.gmo hello-2.1.1/po/sk.gmo hello-2.1.1/po/sl.gmo hello-2.1.1/po/sv.gmo hello-2.1.1/po/tr.gmo hello-2.1.1/po/uk.gmo hello-2.1.1/po/ChangeLog hello-2.1.1/po/LINGUAS hello-2.1.1/README hello-2.1.1/ABOUT-NLS hello-2.1.1/AUTHORS hello-2.1.1/COPYING hello-2.1.1/ChangeLog hello-2.1.1/INSTALL hello-2.1.1/Makefile.am hello-2.1.1/Makefile.in hello-2.1.1/NEWS hello-2.1.1/THANKS hello-2.1.1/TODO hello-2.1.1/aclocal.m4 hello-2.1.1/config.guess hello-2.1.1/config.h.in hello-2.1.1/config.rpath hello-2.1.1/config.sub hello-2.1.1/configure hello-2.1.1/configure.ac hello-2.1.1/depcomp hello-2.1.1/install-sh hello-2.1.1/missing hello-2.1.1/mkinstalldirs hello-2.1.1/BUGS hello-2.1.1/ChangeLog.O hello-2.1.1/contrib/ hello-2.1.1/contrib/ChangeLog hello-2.1.1/contrib/Makefile.am hello-2.1.1/contrib/Makefile.in hello-2.1.1/contrib/de_franconian_po.txt hello-2.1.1/contrib/evolution.txt hello-2.1.1/contrib/hello.1 hello-2.1.1/doc/ hello-2.1.1/doc/gpl.texi hello-2.1.1/doc/ChangeLog hello-2.1.1/doc/Makefile.am hello-2.1.1/doc/Makefile.in hello-2.1.1/doc/mdate-sh hello-2.1.1/doc/stamp-vti hello-2.1.1/doc/texinfo.tex hello-2.1.1/doc/version.texi hello-2.1.1/doc/hello.texi hello-2.1.1/doc/hello.info hello-2.1.1/src/ hello-2.1.1/src/ChangeLog hello-2.1.1/src/Makefile.am hello-2.1.1/src/Makefile.in hello-2.1.1/src/alloca.c hello-2.1.1/src/hello.c hello-2.1.1/src/version.c hello-2.1.1/src/getopt.c hello-2.1.1/src/getopt1.c hello-2.1.1/src/getopt.h hello-2.1.1/src/system.h hello-2.1.1/man/ hello-2.1.1/man/ChangeLog hello-2.1.1/man/Makefile.am hello-2.1.1/man/Makefile.in hello-2.1.1/man/hello.1 hello-2.1.1/man/help2man hello-2.1.1/m4/ hello-2.1.1/m4/README hello-2.1.1/m4/ChangeLog hello-2.1.1/m4/Makefile.am hello-2.1.1/m4/Makefile.in hello-2.1.1/m4/codeset.m4 hello-2.1.1/m4/gettext.m4 hello-2.1.1/m4/glibc21.m4 hello-2.1.1/m4/iconv.m4 hello-2.1.1/m4/isc-posix.m4 hello-2.1.1/m4/lcmessage.m4 hello-2.1.1/m4/lib-ld.m4 hello-2.1.1/m4/lib-link.m4 hello-2.1.1/m4/lib-prefix.m4 hello-2.1.1/m4/progtest.m4 hello-2.1.1/tests/ hello-2.1.1/tests/ChangeLog hello-2.1.1/tests/Makefile.am hello-2.1.1/tests/Makefile.in hello-2.1.1/tests/hello-1 hello-2.1.1/tests/world-1 hello-2.1.1/tests/nothing-1
Changez de répertoire :
root@debian:~# cd hello-2.1.1/
A l'étude du fichier README, celui-ci nous renvoie vers le fichier INSTALL. Visualisez donc ce dernier :
root@debian:~/hello-2.1.1# more INSTALL Copyright 1994, 1995, 1996, 1999, 2000, 2001 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is --More--(10%)
La procédure expliquée est celle utilisée pour la plupart des installations manuelles, à savoir la saisie des quatre commandes suivantes.
./configure
<note important> configure est un script chargé de créer les makefiles pour une architecture donnée. Les makefiles sont lus par la commande make. </note>
root@debian:~/hello-2.1.1# ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... no checking for mawk... mawk checking whether make sets ${MAKE}... yes checking for gcc... gcc checking for C compiler default output... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking for strerror in -lcposix... no checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for string.h... (cached) yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking sys/file.h usability... yes checking sys/file.h presence... yes checking for sys/file.h... yes checking sys/param.h usability... yes checking sys/param.h presence... yes checking for sys/param.h... yes checking for working alloca.h... yes checking for alloca... yes checking for struct stat.st_blksize... yes checking for msgfmt... no checking for gmsgfmt... : checking for xgettext... no checking for msgmerge... no checking build system type... i686-pc-linux checking host system type... i686-pc-linux checking for ranlib... ranlib checking for gcc option to accept ANSI C... none needed checking for an ANSI C-conforming const... yes checking for inline... inline checking for off_t... yes checking for size_t... yes checking for stdlib.h... (cached) yes checking for unistd.h... (cached) yes checking for getpagesize... yes checking for working mmap... yes checking whether we are using the GNU C Library 2.1 or newer... yes checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for shared library run path origin... done checking for iconv... yes checking argz.h usability... yes checking argz.h presence... yes checking for argz.h... yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking nl_types.h usability... yes checking nl_types.h presence... yes checking for nl_types.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking for unistd.h... (cached) yes checking for sys/param.h... (cached) yes checking for feof_unlocked... yes checking for fgets_unlocked... yes checking for getc_unlocked... yes checking for getcwd... yes checking for getegid... yes checking for geteuid... yes checking for getgid... yes checking for getuid... yes checking for mempcpy... yes checking for munmap... yes checking for putenv... yes checking for setenv... yes checking for setlocale... yes checking for stpcpy... yes checking for strcasecmp... yes checking for strdup... yes checking for strtoul... yes checking for tsearch... yes checking for __argz_count... yes checking for __argz_stringify... yes checking for __argz_next... yes checking for iconv declaration... extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); checking for nl_langinfo and CODESET... yes checking for LC_MESSAGES... yes checking for bison... no checking whether NLS is requested... yes checking whether included gettext is requested... no checking for GNU gettext in libc... yes checking for perl... perl configure: creating ./config.status config.status: creating Makefile config.status: creating contrib/Makefile config.status: creating doc/Makefile config.status: creating intl/Makefile config.status: creating man/Makefile config.status: creating po/Makefile.in config.status: creating m4/Makefile config.status: creating src/Makefile config.status: creating tests/Makefile config.status: creating config.h config.status: executing depfiles commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile config.status: executing default commands
make
<note important> make sert à appeler des commandes créant des fichiers nécessaires à l'installation du logiciel. </note>
root@debian:~/hello-2.1.1# make make all-recursive make[1]: entrant dans le répertoire « /root/hello-2.1.1 » Making all in contrib make[2]: entrant dans le répertoire « /root/hello-2.1.1/contrib » make[2]: Rien à faire pour « all ». make[2]: quittant le répertoire « /root/hello-2.1.1/contrib » Making all in doc make[2]: entrant dans le répertoire « /root/hello-2.1.1/doc » make[2]: Rien à faire pour « all ». make[2]: quittant le répertoire « /root/hello-2.1.1/doc » Making all in intl make[2]: entrant dans le répertoire « /root/hello-2.1.1/intl » make[2]: Rien à faire pour « all ». make[2]: quittant le répertoire « /root/hello-2.1.1/intl » Making all in po make[2]: entrant dans le répertoire « /root/hello-2.1.1/po » make[2]: Rien à faire pour « all ». make[2]: quittant le répertoire « /root/hello-2.1.1/po » Making all in src make[2]: entrant dans le répertoire « /root/hello-2.1.1/src » source='hello.c' object='hello.o' libtool=no \ depfile='.deps/hello.Po' tmpdepfile='.deps/hello.TPo' \ depmode=gcc3 /bin/bash ../depcomp \ gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I. -I. -I.. -I../intl -I../intl -g -O2 -c `test -f 'hello.c' || echo './'`hello.c source='version.c' object='version.o' libtool=no \ depfile='.deps/version.Po' tmpdepfile='.deps/version.TPo' \ depmode=gcc3 /bin/bash ../depcomp \ gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I. -I. -I.. -I../intl -I../intl -g -O2 -c `test -f 'version.c' || echo './'`version.c source='getopt.c' object='getopt.o' libtool=no \ depfile='.deps/getopt.Po' tmpdepfile='.deps/getopt.TPo' \ depmode=gcc3 /bin/bash ../depcomp \ gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I. -I. -I.. -I../intl -I../intl -g -O2 -c `test -f 'getopt.c' || echo './'`getopt.c source='getopt1.c' object='getopt1.o' libtool=no \ depfile='.deps/getopt1.Po' tmpdepfile='.deps/getopt1.TPo' \ depmode=gcc3 /bin/bash ../depcomp \ gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I. -I. -I.. -I../intl -I../intl -g -O2 -c `test -f 'getopt1.c' || echo './'`getopt1.c gcc -g -O2 -o hello hello.o version.o getopt.o getopt1.o make[2]: quittant le répertoire « /root/hello-2.1.1/src » Making all in man make[2]: entrant dans le répertoire « /root/hello-2.1.1/man » perl help2man --name="Friendly Greeting Program" ../src/hello >hello.1 make[2]: quittant le répertoire « /root/hello-2.1.1/man » Making all in m4 make[2]: entrant dans le répertoire « /root/hello-2.1.1/m4 » make[2]: Rien à faire pour « all ». make[2]: quittant le répertoire « /root/hello-2.1.1/m4 » Making all in tests make[2]: entrant dans le répertoire « /root/hello-2.1.1/tests » make[2]: Rien à faire pour « all ». make[2]: quittant le répertoire « /root/hello-2.1.1/tests » make[2]: entrant dans le répertoire « /root/hello-2.1.1 » make[2]: Rien à faire pour « all-am ». make[2]: quittant le répertoire « /root/hello-2.1.1 » make[1]: quittant le répertoire « /root/hello-2.1.1 »
make check
<note important> make check permet de vérifier si la commande make a bien fonctionné. </note>
root@debian:~/hello-2.1.1# make check Making check in contrib make[1]: entrant dans le répertoire « /root/hello-2.1.1/contrib » make[1]: Rien à faire pour « check ». make[1]: quittant le répertoire « /root/hello-2.1.1/contrib » Making check in doc make[1]: entrant dans le répertoire « /root/hello-2.1.1/doc » make[1]: Rien à faire pour « check ». make[1]: quittant le répertoire « /root/hello-2.1.1/doc » Making check in intl make[1]: entrant dans le répertoire « /root/hello-2.1.1/intl » make[1]: Rien à faire pour « check ». make[1]: quittant le répertoire « /root/hello-2.1.1/intl » Making check in po make[1]: entrant dans le répertoire « /root/hello-2.1.1/po » make[1]: Rien à faire pour « check ». make[1]: quittant le répertoire « /root/hello-2.1.1/po » Making check in src make[1]: entrant dans le répertoire « /root/hello-2.1.1/src » make[1]: Rien à faire pour « check ». make[1]: quittant le répertoire « /root/hello-2.1.1/src » Making check in man make[1]: entrant dans le répertoire « /root/hello-2.1.1/man » make[1]: Rien à faire pour « check ». make[1]: quittant le répertoire « /root/hello-2.1.1/man » Making check in m4 make[1]: entrant dans le répertoire « /root/hello-2.1.1/m4 » make[1]: Rien à faire pour « check ». make[1]: quittant le répertoire « /root/hello-2.1.1/m4 » Making check in tests make[1]: entrant dans le répertoire « /root/hello-2.1.1/tests » make check-TESTS make[2]: entrant dans le répertoire « /root/hello-2.1.1/tests » PASS: hello-1 PASS: world-1 PASS: nothing-1 ================== All 3 tests passed ================== make[2]: quittant le répertoire « /root/hello-2.1.1/tests » make[1]: quittant le répertoire « /root/hello-2.1.1/tests » make[1]: entrant dans le répertoire « /root/hello-2.1.1 » make[1]: Rien à faire pour « check-am ». make[1]: quittant le répertoire « /root/hello-2.1.1 »
make install
<note important> make install sert à installer le logiciel. </note>
root@debian:~/hello-2.1.1# make install Making install in contrib make[1]: entrant dans le répertoire « /root/hello-2.1.1/contrib » make[2]: entrant dans le répertoire « /root/hello-2.1.1/contrib » make[2]: Rien à faire pour « install-exec-am ». make[2]: Rien à faire pour « install-data-am ». make[2]: quittant le répertoire « /root/hello-2.1.1/contrib » make[1]: quittant le répertoire « /root/hello-2.1.1/contrib » Making install in doc make[1]: entrant dans le répertoire « /root/hello-2.1.1/doc » make[2]: entrant dans le répertoire « /root/hello-2.1.1/doc » make[2]: Rien à faire pour « install-exec-am ». /bin/bash ../mkinstalldirs /usr/local/info mkdir -p -- /usr/local/info /usr/bin/install -c -m 644 ./hello.info /usr/local/info/hello.info install-info --info-dir=/usr/local/info /usr/local/info/hello.info This is not dpkg install-info anymore, but GNU install-info See the man page for ginstall-info for command line arguments make[2]: quittant le répertoire « /root/hello-2.1.1/doc » make[1]: quittant le répertoire « /root/hello-2.1.1/doc » Making install in intl make[1]: entrant dans le répertoire « /root/hello-2.1.1/intl » if test "hello" = "gettext" \ && test '' = 'intl-compat.o'; then \ /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/lib /usr/local/include; \ /usr/bin/install -c -m 644 libintl.h /usr/local/include/libintl.h; \ @LIBTOOL@ --mode=install \ /usr/bin/install -c -m 644 libintl.a /usr/local/lib/libintl.a; \ else \ : ; \ fi if test 'no' = yes; then \ test yes != no || /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/lib; \ temp=/usr/local/lib/t-charset.alias; \ dest=/usr/local/lib/charset.alias; \ if test -f /usr/local/lib/charset.alias; then \ orig=/usr/local/lib/charset.alias; \ sed -f ref-add.sed $orig > $temp; \ /usr/bin/install -c -m 644 $temp $dest; \ rm -f $temp; \ else \ if test yes = no; then \ orig=charset.alias; \ sed -f ref-add.sed $orig > $temp; \ /usr/bin/install -c -m 644 $temp $dest; \ rm -f $temp; \ fi; \ fi; \ /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/share/locale; \ test -f /usr/local/share/locale/locale.alias \ && orig=/usr/local/share/locale/locale.alias \ || orig=./locale.alias; \ temp=/usr/local/share/locale/t-locale.alias; \ dest=/usr/local/share/locale/locale.alias; \ sed -f ref-add.sed $orig > $temp; \ /usr/bin/install -c -m 644 $temp $dest; \ rm -f $temp; \ else \ : ; \ fi if test "hello" = "gettext"; then \ /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/share/gettext/intl; \ /usr/bin/install -c -m 644 VERSION /usr/local/share/gettext/intl/VERSION; \ /usr/bin/install -c -m 644 ChangeLog.inst /usr/local/share/gettext/intl/ChangeLog; \ dists="COPYING.LIB-2.0 COPYING.LIB-2.1 Makefile.in config.charset locale.alias ref-add.sin ref-del.sin gmo.h gettextP.h hash-string.h plural-exp.h eval-plural.h os2compat.h libgnuintl.h loadinfo.h bindtextdom.c dcgettext.c dgettext.c gettext.c finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c explodename.c dcigettext.c dcngettext.c dngettext.c ngettext.c plural.y plural-exp.c localcharset.c localename.c osdep.c os2compat.c intl-compat.c"; \ for file in $dists; do \ /usr/bin/install -c -m 644 ./$file \ /usr/local/share/gettext/intl/$file; \ done; \ chmod a+x /usr/local/share/gettext/intl/config.charset; \ dists="plural.c"; \ for file in $dists; do \ if test -f $file; then dir=.; else dir=.; fi; \ /usr/bin/install -c -m 644 $dir/$file \ /usr/local/share/gettext/intl/$file; \ done; \ dists="xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c COPYING.LIB-2 gettext.h libgettext.h plural-eval.c"; \ for file in $dists; do \ rm -f /usr/local/share/gettext/intl/$file; \ done; \ else \ : ; \ fi make[1]: quittant le répertoire « /root/hello-2.1.1/intl » Making install in po make[1]: entrant dans le répertoire « /root/hello-2.1.1/po » /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/share mkdir -p -- /usr/local/share/locale/ca/LC_MESSAGES installing ca.gmo as /usr/local/share/locale/ca/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/da/LC_MESSAGES installing da.gmo as /usr/local/share/locale/da/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/de/LC_MESSAGES installing de.gmo as /usr/local/share/locale/de/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/de_DE/LC_MESSAGES installing de_DE.gmo as /usr/local/share/locale/de_DE/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/el/LC_MESSAGES installing el.gmo as /usr/local/share/locale/el/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/eo/LC_MESSAGES installing eo.gmo as /usr/local/share/locale/eo/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/es/LC_MESSAGES installing es.gmo as /usr/local/share/locale/es/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/et/LC_MESSAGES installing et.gmo as /usr/local/share/locale/et/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/fi/LC_MESSAGES installing fi.gmo as /usr/local/share/locale/fi/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/fr/LC_MESSAGES installing fr.gmo as /usr/local/share/locale/fr/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/gl/LC_MESSAGES installing gl.gmo as /usr/local/share/locale/gl/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/he/LC_MESSAGES installing he.gmo as /usr/local/share/locale/he/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/hr/LC_MESSAGES installing hr.gmo as /usr/local/share/locale/hr/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/hu/LC_MESSAGES installing hu.gmo as /usr/local/share/locale/hu/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/id/LC_MESSAGES installing id.gmo as /usr/local/share/locale/id/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/it/LC_MESSAGES installing it.gmo as /usr/local/share/locale/it/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/ja/LC_MESSAGES installing ja.gmo as /usr/local/share/locale/ja/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/ko/LC_MESSAGES installing ko.gmo as /usr/local/share/locale/ko/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/lv/LC_MESSAGES installing lv.gmo as /usr/local/share/locale/lv/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/nb/LC_MESSAGES installing nb.gmo as /usr/local/share/locale/nb/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/nl/LC_MESSAGES installing nl.gmo as /usr/local/share/locale/nl/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/nn/LC_MESSAGES installing nn.gmo as /usr/local/share/locale/nn/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/pl/LC_MESSAGES installing pl.gmo as /usr/local/share/locale/pl/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/pt/LC_MESSAGES installing pt.gmo as /usr/local/share/locale/pt/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/pt_BR/LC_MESSAGES installing pt_BR.gmo as /usr/local/share/locale/pt_BR/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/ru/LC_MESSAGES installing ru.gmo as /usr/local/share/locale/ru/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/sk/LC_MESSAGES installing sk.gmo as /usr/local/share/locale/sk/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/sl/LC_MESSAGES installing sl.gmo as /usr/local/share/locale/sl/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/sv/LC_MESSAGES installing sv.gmo as /usr/local/share/locale/sv/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/tr/LC_MESSAGES installing tr.gmo as /usr/local/share/locale/tr/LC_MESSAGES/hello.mo mkdir -p -- /usr/local/share/locale/uk/LC_MESSAGES installing uk.gmo as /usr/local/share/locale/uk/LC_MESSAGES/hello.mo if test "hello" = "gettext"; then \ /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/share/gettext/po; \ for file in Makefile.in.in Makevars remove-potcdate.sin quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot ; do \ /usr/bin/install -c -m 644 ./$file \ /usr/local/share/gettext/po/$file; \ done; \ else \ : ; \ fi make[1]: quittant le répertoire « /root/hello-2.1.1/po » Making install in src make[1]: entrant dans le répertoire « /root/hello-2.1.1/src » make[2]: entrant dans le répertoire « /root/hello-2.1.1/src » /bin/bash ../mkinstalldirs /usr/local/bin /usr/bin/install -c hello /usr/local/bin/hello make[2]: Rien à faire pour « install-data-am ». make[2]: quittant le répertoire « /root/hello-2.1.1/src » make[1]: quittant le répertoire « /root/hello-2.1.1/src » Making install in man make[1]: entrant dans le répertoire « /root/hello-2.1.1/man » make[2]: entrant dans le répertoire « /root/hello-2.1.1/man » make[2]: Rien à faire pour « install-exec-am ». /bin/bash ../mkinstalldirs /usr/local/man/man1 mkdir -p -- /usr/local/man/man1 /usr/bin/install -c -m 644 ./hello.1 /usr/local/man/man1/hello.1 make[2]: quittant le répertoire « /root/hello-2.1.1/man » make[1]: quittant le répertoire « /root/hello-2.1.1/man » Making install in m4 make[1]: entrant dans le répertoire « /root/hello-2.1.1/m4 » make[2]: entrant dans le répertoire « /root/hello-2.1.1/m4 » make[2]: Rien à faire pour « install-exec-am ». make[2]: Rien à faire pour « install-data-am ». make[2]: quittant le répertoire « /root/hello-2.1.1/m4 » make[1]: quittant le répertoire « /root/hello-2.1.1/m4 » Making install in tests make[1]: entrant dans le répertoire « /root/hello-2.1.1/tests » make[2]: entrant dans le répertoire « /root/hello-2.1.1/tests » make[2]: Rien à faire pour « install-exec-am ». make[2]: Rien à faire pour « install-data-am ». make[2]: quittant le répertoire « /root/hello-2.1.1/tests » make[1]: quittant le répertoire « /root/hello-2.1.1/tests » make[1]: entrant dans le répertoire « /root/hello-2.1.1 » make[2]: entrant dans le répertoire « /root/hello-2.1.1 » make[2]: Rien à faire pour « install-exec-am ». make[2]: Rien à faire pour « install-data-am ». make[2]: quittant le répertoire « /root/hello-2.1.1 » make[1]: quittant le répertoire « /root/hello-2.1.1 »
Il convient maintenant de tester le nouveau logiciel :
root@debian:~/hello-2.1.1# hello Bonjour, le monde!
Le logiciel hello a été correctement installé.
La commande dpkg
<note> Placez-vous dans le répertoire personnel de root grâce à la commande cd ~. </note>
Afin de faciliter l'installation, la désinstallation et la gestion des logiciels (appelés paquets) sous Linux, Debian et ses dérivés utilisent un format de fichier de logiciels installables spécifique. Celui-ci s'appelle DEB. La commande utilisée pour manipuler ses paquetages s'appelle dpkg.
Les options de la commande dpkg sont :
root@debian:~# dpkg --help Syntaxe : dpkg [<option> ...] <commande> Commandes : -i|--install <nom fichier .deb> ... | -R|--recursive <rép> ... --unpack <nom fichier .deb> ... | -R|--recursive <rép> ... -A|--record-avail <nom fichier .deb> ... | -R|--recursive <rép> ... --configure <nom paquet> ... | -a|--pending --triggers-only <nom paquet> ... | -a|--pending -r|--remove <nom paquet> ... | -a|--pending -P|--purge <nom paquet> ... | -a|--pending --get-selections [<motif> ...] Afficher la liste des sélections sur la sortie standard --set-selections Paramétrer la liste des sélections à partir de l'entrée standard --clear-selections Supprimer tous les paquets non essentiels --update-avail <fichier paquets> Remplacer les informations sur les paquets disponibles --merge-avail <fichier paquets> Fusionner les informations avec celles issues du fichier --clear-avail Effacer les informations sur les paquets --forget-old-unavail Oublier les paquets non installés et non-disponibles -s|--status <nom paquet> ... Afficher les détails de l'état du paquet -p|--print-avail <nom paquet> ... Afficher les détails de la version disponible -L|--listfiles <nom paquet> ... Lister les fichiers appartenant au(x) paquet(s) -l|--list [<motif> ...] Lister les paquets en condensé -S|--search <motif> ... Trouver le(s) paquet(s) contenant le(s) fichier(s) -C|--audit Chercher d'éventuel(s) paquet(s) abîmé(s) --print-architecture Afficher l'architecture cible (utilise GCC) --compare-versions <a> <rel> <b> Comparer les numéros de version (voir ci-dessous) --help | --version Afficher cette aide et le numéro de version --force-help Afficher l'aide sur le forçage -Dh|--debug=help Afficher l'aide sur le débogage -h|--help Afficher ce message. --version Afficher la version. Utiliser dpkg -b|--build|-c|--contents|-e|--control|-I|--info|-f|--field| -x|--extract|-X|--vextract|--fsys-tarfile sur les archives (taper dpkg-deb --help.) À usage interne : dpkg --assert-support-predepends | --predep-package | --assert-working-epoch | --assert-long-filenames | --assert-multi-conrep Options : --admindir=<rép.> Utiliser le répertoire <rép.> au lieu de /var/lib/dpkg. --root=<rép.> Installer sur un système alternatif dont la racine est située à un autre endroit. --instdir=<rép.> Changer la racine d'installation sans changer le répertoire d'administration. --path-exclude=<motif> Ne pas installer les chemins qui correspondent à un motif du shell. --path-include=<pattern> Réinclure un motif après une exclusion antérieure. -O|--selected-only Ignorer les paquets non sélectionnées pour être installés/mis à niveau. -E|--skip-same-version Ignorer les paquets dont la version est la même que celle installée. -G|--refuse-downgrade Ignorer les paquets dont la version est moins récente que celle installée. -B|--auto-deconfigure Installer même si cela entraîne la rupture d'autres paquets. --[no-]triggers Passe ou force les actions différées invoqués par le traitement. --no-debsig Ne pas tenter d'authentifier les signatures des paquets. --no-act|--dry-run|--simulate Seulement afficher les actions à effectuer sans les réaliser. -D|--debug=<octal> Activer le débogage (voir -Dhelp ou --debug=help). --status-fd <n> Envoyer les mises à jour d'état au descripteur de fichier <n>. --log=<fichier> Enregistrer dans <fichier> les changements d'état et les actions effectuées. --ignore-depends=<paquet>,... Ignorer les dépendances impliquant <paquet>. --force-... Outrepasser les problèmes - voir --force-help. --no-force-...|--refuse-... Arrêter en cas de problèmes. --abort-after <n> Arrêter après avoir rencontré <n> erreurs. Les opérateurs de comparaison pour --compare-versions sont les suivants : lt le eq ne ge gt (ne considérer aucune version comme plus tardive que n'importe quelle version) lt-nl le-nl ge-nl gt-nl (ne considérer aucune version comme plus récente que n'importe quelle version) < << <= = >= >> > (uniquement pour des raison de compatibilité avec la syntaxe du fichier control) Utilisez « dselect » ou « aptitude » pour gérer les paquets de manière plus conviviale.
Afin de connaître la liste des paquets disponibles sur la machine, il convient de saisir la commande suivante dans une fenêtre de console en tant que root :
root@debian:~# dpkg -l | more Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder | État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements |/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais) ||/ Nom Version Description +++-====================================-=================================-========================================================================== ii acpi 1.5-2 displays information on ACPI devices ii acpi-support-base 0.137-5 scripts for handling base ACPI events such as the power button ii acpid 1:2.0.7-1 Advanced Configuration and Power Interface event daemon ii adduser 3.112+nmu2 add and remove users and groups ii alacarte 0.13.2-1 easy GNOME menu editing tool ii alsa-base 1.0.23+dfsg-2 ALSA driver configuration files ii alsa-utils 1.0.23-3 Utilities for configuring and using ALSA ii anacron 2.3-14 cron-like program that doesn't go by time ii apache2.2-bin 2.2.16-6+squeeze1 Apache HTTP Server common binary files ii app-install-data 2010.11.17 Application Installer Data Files ii apt 0.8.10.3 Advanced front-end for dpkg ii apt-listchanges 2.85.7 package change history notification tool ii apt-utils 0.8.10.3 APT utility programs ii apt-xapian-index 0.41 maintenance and search tools for a Xapian index of Debian packages ii aptdaemon 0.31+bzr413-1.1 transaction based package management service ii aptitude 0.6.3-3.2 terminal-based package manager (terminal interface only) ii aspell 0.60.6-4 GNU Aspell spell-checker ii aspell-fr 0.50-3-7 French dictionary for aspell ii at 3.1.12-1 Delayed job execution and batch processing ii at-spi 1.30.1-3 Assistive Technology Service Provider Interface ii avahi-daemon 0.6.27-2+squeeze1 Avahi mDNS/DNS-SD daemon ii baobab 2.30.0-2 GNOME disk usage analyzer ii base-files 6.0squeeze1 Debian base system miscellaneous files --More--
<note important> L'option -l liste les paquets disponibles spécifiés par le fichier /var/lib/dpkg/available. </note>
root@debian:~# more /var/lib/dpkg/available Package: libexempi3 Priority: optional Section: libs Installed-Size: 1016 Maintainer: Asheesh Laroia <asheesh@asheesh.org> Architecture: i386 Source: exempi Version: 2.1.1-1 Depends: libc6 (>= 2.3), libexpat1 (>= 1.95.8), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.2.1), zlib1g (>= 1:1.1.4) Size: 409634 Description: library to parse XMP metadata (Library) Exempi is a library to parse XMP metadata as defined by the specification. . XMP (Extensible Metadata Platform) facilitates embedding metadata in files using a subset of RDF. Most notably XMP supports embedding metadata in PDF and many image formats, though it is designed to support nearly any file type. Homepage: http://libopenraw.freedesktop.org/wiki/Exempi Package: libdb-je-java Priority: optional Section: java Installed-Size: 2000 Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org> Architecture: all Version: 3.3.62-3 Depends: default-jre-headless | java2-runtime-headless Size: 1384924 --More--(0%)
Le statut de chaque paquet est inclus dans le fichier /var/lib/dpkg/status :
root@debian:~# more /var/lib/dpkg/status Package: libexempi3 Status: install ok installed Priority: optional Section: libs Installed-Size: 1016 Maintainer: Asheesh Laroia <asheesh@asheesh.org> Architecture: i386 Source: exempi Version: 2.1.1-1 Depends: libc6 (>= 2.3), libexpat1 (>= 1.95.8), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.2.1), zlib1g (>= 1:1.1.4) Description: library to parse XMP metadata (Library) Exempi is a library to parse XMP metadata as defined by the specification. . XMP (Extensible Metadata Platform) facilitates embedding metadata in files using a subset of RDF. Most notably XMP supports embedding metadata in PDF and many image formats, though it is designed to support nearly any file type. Homepage: http://libopenraw.freedesktop.org/wiki/Exempi Package: libdb-je-java Status: install ok installed Priority: optional Section: java Installed-Size: 2000 Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org> Architecture: all Version: 3.3.62-3 Depends: default-jre-headless | java2-runtime-headless --More--(0%)
Afin de connaître le nombre total de paquets disponibles, utilisez la commande suivante :
root@debian:~# dpkg -l | wc -l 1313
Afin de connaître le nombre total de paquets installés, utilisez la commande suivante :
root@debian:~# dpkg --get-selections | wc -l 1308
Imaginons maintenant que vous souhaitez vérifier si un paquet contenant la chaîne de caractères zip soit déjà installé sur la machine. Dans ce cas, il convient d'abord d'utiliser la commande suivante :
root@debian:~# dpkg --get-selections | grep zip bzip2 install gzip install libmono-sharpzip2.84-cil install p7zip-full install unzip install
Afin de connaître le statut de du paquet gzip, il convient de saisir la commande suivante :
root@debian:~# dpkg -s gzip Package: gzip Essential: yes Status: install ok installed Priority: required Section: utils Installed-Size: 276 Maintainer: Bdale Garbee <bdale@gag.com> Architecture: i386 Version: 1.3.12-9 Pre-Depends: libc6 (>= 2.4) Suggests: less Description: GNU compression utilities This package provides the standard GNU file compression utilities, which are also the default compression tools for Debian. They typically operate on files with names ending in '.gz', but can also decompress files ending in '.Z' created with 'compress'.
Afin de lister tous les fichiers installés par le paquet gzip, utilisez la commande suivante :
root@debian:~# dpkg -L gzip /. /usr /usr/share /usr/share/man /usr/share/man/man1 /usr/share/man/man1/zforce.1.gz /usr/share/man/man1/gzip.1.gz /usr/share/man/man1/zdiff.1.gz /usr/share/man/man1/zmore.1.gz /usr/share/man/man1/zless.1.gz /usr/share/man/man1/gzexe.1.gz /usr/share/man/man1/zgrep.1.gz /usr/share/man/man1/znew.1.gz /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/gzip /usr/share/info /usr/share/info/gzip.info.gz /usr/share/doc /usr/share/doc/gzip /usr/share/doc/gzip/changelog.Debian.gz /usr/share/doc/gzip/README.gz /usr/share/doc/gzip/README-alpha /usr/share/doc/gzip/TODO /usr/share/doc/gzip/copyright /usr/share/doc/gzip/changelog.gz /bin /bin/zless /bin/zgrep /bin/zcmp /bin/zcat /bin/zfgrep /bin/zegrep /bin/zmore /bin/gunzip /bin/gzip /bin/znew /bin/uncompress /bin/zdiff /bin/zforce /bin/gzexe /usr/share/man/man1/uncompress.1.gz /usr/share/man/man1/zcmp.1.gz /usr/share/man/man1/zcat.1.gz /usr/share/man/man1/zfgrep.1.gz /usr/share/man/man1/gunzip.1.gz /usr/share/man/man1/zegrep.1.gz
A l'inverse, si vous connaissez le nom d'un fichier et vous souhaitez savoir quel paquet l'a installé, utilisez la commande suivante :
root@debian:~# dpkg -S /bin/zfgrep gzip: /bin/zfgrep
Le fichier /etc/dpkg/dpkg.cfg contient les directives de configuration et les options de la commande dpkg :
root@debian:~# cat /etc/dpkg/dpkg.cfg # dpkg configuration file # # This file can contain default options for dpkg. All command-line # options are allowed. Values can be specified by putting them after # the option, separated by whitespace and/or an `=' sign. # # Do not enable debsig-verify by default; since the distribution is not using # embedded signatures, debsig-verify would reject all packages. no-debsig # Log status changes and actions to a file. log /var/log/dpkg.log
La Commande dselect
La commande dselect est un outil interactif utilisé pour gérer, installer et désinstaller des paquets. C'est un Front End à la commande dpkg et est lancé sans options.
La commande dselect n'est pas installé par défaut. Il convient donc d'utiliser la commande apt-get pour l'installer :
root@debian:~# apt-get install dselect Lecture des listes de paquets... Fait Construction de l'arbre des dépendances Lecture des informations d'état... Fait Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires : samba-common-bin samba-common Veuillez utiliser « apt-get autoremove » pour les supprimer. Les NOUVEAUX paquets suivants seront installés : dselect 0 mis à jour, 1 nouvellement installés, 0 à enlever et 71 non mis à jour. Il est nécessaire de prendre 902 ko dans les archives. Après cette opération, 2 449 ko d'espace disque supplémentaires seront utilisés. Réception de : 1 http://ftp.fr.debian.org/debian/ squeeze/main dselect i386 1.15.8.13 [902 kB] 902 ko réceptionnés en 8s (106 ko/s) Sélection du paquet dselect précédemment désélectionné. (Lecture de la base de données... 131427 fichiers et répertoires déjà installés.) Dépaquetage de dselect (à partir de .../dselect_1.15.8.13_i386.deb) ... Traitement des actions différées (« triggers ») pour « man-db »... Paramétrage de dselect (1.15.8.13) ...
Lancez maintenant dselect :
Interface de gestion de paquets Debian « dselect » version 1.15.8.13 (i386). * 0. [A]ccéder Choisir la méthode d'accès à utiliser 1. [M]ise à j Mise à jour de l'information sur les paquets disponibles, si possible. 2. [S]électio Sélection des paquets que vous désirez avoir sur votre système. 3. [I]nstaller Installation et mise à niveau des paquets désirés. 4. [C]onfigure Configuration de tout paquet non configuré. 5. [R]etirer Suppression des applications non désirées. 6. [Q]uitter Quitter dselect. Utilisez ^P et ^N, les touches fléchées, les lettres initiales ou les chiffres pour vous déplacer ; Appuyez sur <Entrée> pour confirmer la sélection. ^L pour redessiner l'écran. Copyright (C) 1994-1996 Ian Jackson. Copyright (C) 2000,2001 Wichert Akkerman. Ce programme est un logiciel libre ; prière de consulter la « GNU General Public License » version 2 ou supérieure pour prendre connaissance des conditions de reproduction. AUCUNE garantie n'est offerte.
<note> Notez les instructions en bas de l'écran et expérimentez avec l'interface. </note>
La commande apt-get
APT ou en anglais Advanced Package Tool est un gestionnaire de paquets de haut niveau capable de résoudre automatiquement les problèmes de dépendances entre les paquets.
La commande apt-get prend la forme suivante :
# apt-get <options> <commande> <paquet(s)> [Entrée]
Les options et commandes de la commande apt-get sont :
root@debian:~# apt-get --help apt 0.8.10.3 pour i386 compilé sur Jan 25 2011 11:55:25 Usage : apt-get [options] commandes apt-get [options] install|remove pkg1 [pkg2 ...] apt-get [options] source pkg1 [pkg2 ...] apt-get est une interface simple en ligne de commande servant à télécharger et à installer les paquets. Les commandes les plus fréquemment employées sont update et install. Commandes : update - Récupère les nouvelles listes de paquets upgrade - Réalise une mise à jour install - Installe de nouveaux paquets (pkg1 est libc6 et non libc6.deb) remove - Supprime des paquets autoremove - Supprime tous les paquets installés automatiquement purge - Supprime des paquets et leurs fichiers de configuration source - Télécharge les archives de sources build-dep - Configure build-dependencies pour les paquets sources dist-upgrade - Met à jour la distribution, reportez-vous à apt-get(8) dselect-upgrade - Suit les sélections de dselect clean - Supprime dans le cache local tous les fichiers téléchargés autoclean - Supprime dans le cache local les fichiers inutiles check - Vérifie qu'il n'y a pas de rupture de dépendances markauto - Marque les paquets indiqués comme installés automatiquement unmarkauto - Marque les paquets indiqués comme installés manuellement Options : -h Ce texte d'aide -q Message de sortie enregistrable - aucun indicateur de progression -qq Aucun message de sortie, exceptés les messages d'erreur -d Simple téléchargement - n'installe pas ou ne décompacte pas les archives -s N'agit pas. Réalise uniquement une simulation de commande -y Répond oui à toutes les questions et n'interroge pas l'utilisateur -f Tente de poursuivre si le contrôle d'intégrité échoue -m Tente de poursuivre si les archives ne sont pas localisables -u Affiche une liste des paquets mis à jour -b Construit la source du paquet après l'avoir récupérée -V Affiche les numéros des versions de façon détaillée -c=? Lit ce fichier de configuration -o=? Place une option de configuration arbitraire, ex. -o dir::cache=/tmp Reportez-vous aux pages de manuels d'apt-get(8), sources.list(5) et apt.conf(5) pour plus d'informations et d'option. Cet APT a les « Super Cow Powers »
Configuration
APT peut être configuré par un fichier centralisé /etc/apt/apt.conf. Un exemple est fourni :
root@debian:~# cat /usr/share/doc/apt/examples/apt.conf // $Id: apt.conf,v 1.43 1999/12/06 02:19:38 jgg Exp $ /* This file is a sample configuration file with a few harmless sample options. */ APT { // Options for apt-get Get { Download-Only "false"; }; }; // Options for the downloading routines Acquire { Retries "0"; }; // Things that effect the APT dselect method DSelect { Clean "auto"; // always|auto|prompt|never }; DPkg { // Probably don't want to use force-downgrade.. Options {"--force-overwrite";} }
<note important> Le fichier /etc/apt/apt.conf n'existe pas sous squeeze. La configuration de la commande est donc obtenue à l'aide des options passées à la commande elle-même. </note>
Dépôts
<note important> Un dépôt est un lieu de stockage de paquets binaires prêts à installer. Un dépôt peut être le DVD d'installation de la distribution, un dossier sur disque dur ou bien des serveurs distants accessibles par Internet. </note>
Les dépôts de paquets sont spécifiés soit dans le fichier /etc/apt/sources.list, soit dans un fichier par dépôt stocké dans le répertoire /etc/apt/sources.list.d :
root@debian:~# cat /etc/apt/sources.list # # deb cdrom:[Debian GNU/Linux 6.0.0 _Squeeze_ - Official i386 DVD Binary-1 20110205-17:27]/ squeeze contrib main #deb cdrom:[Debian GNU/Linux 6.0.0 _Squeeze_ - Official i386 DVD Binary-1 20110205-17:27]/ squeeze contrib main deb http://security.debian.org/ squeeze/updates main contrib deb-src http://security.debian.org/ squeeze/updates main contrib deb http://ftp.fr.debian.org/debian squeeze main contrib non-free #deb http://www.debian-multimedia.org squeeze main non-free deb http://backports.debian.org/debian-backports squeeze-backports main # Line commented out by installer because it failed to verify: #deb ://volatile.debian.org squeeze-updates main contrib # Line commented out by installer because it failed to verify: #deb-src ://volatile.debian.org squeeze-updates main contrib
Consultez maintenant le contenu du répertoire /etc/apt/sources.list.d :
root@debian:~# ls /etc/apt/sources.list.d google-chrome.list
Visualisez le contenu du fichier /etc/apt/sources.list.d/google-chrome.list :
root@debian:~# cat /etc/apt/sources.list.d/google-chrome.list ### THIS FILE IS AUTOMATICALLY CONFIGURED ### # You may comment out this entry, but any other modifications may be lost. deb http://dl.google.com/linux/chrome/deb/ stable main
Ces fichiers comportent quatre champs :
- Le premier champ deb ou deb-src
- indique si la source concerne des paquets binaires à installer ou les sources des paquets
- Le deuxième champ indique l'URL de la source
- indique file:// ou copy:// pour un répertoire local
- indique cdrom:// pour un CD ou DVD
- indique http:// pour un serveur web
- indique ftp:// pour un serveur ftp
- Le troisième champ indique la branche Debian
- indique stable, testing ou unstable ou leur nom de correspondant tel squeeze
- Le quatrième champs indique une section de paquets
- main
- contrib
- non-free
- non-US
<note important> Il est possible d'ajouter une source directement en éditant le fichier /etc/apt/sources.list, en créant un fichier spécifique dans le répertoire /etc/apt/sources.list.d ou en utilisant la commande apt-setup. </note>
La mise à jour de la base de références de la description des paquets est effectuée un utilisant la commande suivante :
root@debian:~# apt-get update Atteint http://ftp.fr.debian.org squeeze Release.gpg Réception de : 1 http://dl.google.com stable Release.gpg [198 B] Ign http://dl.google.com/linux/chrome/deb/ stable/main Translation-en Ign http://ftp.fr.debian.org/debian/ squeeze/contrib Translation-en Ign http://dl.google.com/linux/chrome/deb/ stable/main Translation-fr Réception de : 2 http://backports.debian.org squeeze-backports Release.gpg [836 B] Ign http://backports.debian.org/debian-backports/ squeeze-backports/main Translation-en Ign http://backports.debian.org/debian-backports/ squeeze-backports/main Translation-fr Ign http://ftp.fr.debian.org/debian/ squeeze/contrib Translation-fr Réception de : 3 http://dl.google.com stable Release [1 347 B] Réception de : 4 http://backports.debian.org squeeze-backports Release [77,6 kB] Ign http://ftp.fr.debian.org/debian/ squeeze/main Translation-en Réception de : 5 http://dl.google.com stable/main i386 Packages [1 214 B] Réception de : 6 http://security.debian.org squeeze/updates Release.gpg [836 B] Ign http://security.debian.org/ squeeze/updates/contrib Translation-en Ign http://security.debian.org/ squeeze/updates/contrib Translation-fr Atteint http://ftp.fr.debian.org/debian/ squeeze/main Translation-fr Ign http://security.debian.org/ squeeze/updates/main Translation-en Ign http://security.debian.org/ squeeze/updates/main Translation-fr Réception de : 7 http://security.debian.org squeeze/updates Release [86,9 kB] Ign http://ftp.fr.debian.org/debian/ squeeze/non-free Translation-en Ign http://ftp.fr.debian.org/debian/ squeeze/non-free Translation-fr Atteint http://ftp.fr.debian.org squeeze Release Réception de : 8 http://security.debian.org squeeze/updates/main Sources [57,9 kB] Atteint http://ftp.fr.debian.org squeeze/main i386 Packages Réception de : 9 http://backports.debian.org squeeze-backports/main i386 Packages/DiffIndex [6 991 B] Atteint http://ftp.fr.debian.org squeeze/contrib i386 Packages Atteint http://ftp.fr.debian.org squeeze/non-free i386 Packages Réception de : 10 http://security.debian.org squeeze/updates/contrib Sources [14 B] Réception de : 11 http://security.debian.org squeeze/updates/main i386 Packages [181 kB] Réception de : 12 http://backports.debian.org squeeze-backports/main i386 2011-12-18-1436.26.pdiff [1 627 B] Réception de : 13 http://backports.debian.org squeeze-backports/main i386 2011-12-18-1436.26.pdiff [1 627 B] Réception de : 14 http://backports.debian.org squeeze-backports/main i386 2011-12-18-1436.26.pdiff [1 627 B] Réception de : 15 http://backports.debian.org squeeze-backports/main i386 2011-12-18-1536.21.pdiff [1 096 B] Réception de : 16 http://backports.debian.org squeeze-backports/main i386 2011-12-18-1536.21.pdiff [1 096 B] Réception de : 17 http://backports.debian.org squeeze-backports/main i386 2011-12-18-1536.21.pdiff [1 096 B] Réception de : 18 http://security.debian.org squeeze/updates/contrib i386 Packages [678 B] 418 ko réceptionnés en 1s (361 ko/s) Lecture des listes de paquets... Fait
Utilisation
Les commandes les plus utilisées d'apt-get sont :
Commande | Description |
---|---|
install | Installer un ou plusieurs paquets. |
upgrade | Mettre à jour les paquets installés. |
remove | Supprimer un paquet. |
purge | Supprimer un paquet et ses fichiers de configuration. |
T.P.#1
Commencez par installer le paquet mc :
root@debian:~# apt-get install mc Lecture des listes de paquets... Fait Construction de l'arbre des dépendances Lecture des informations d'état... Fait Paquets suggérés : zip arj dbview odt2txt gv catdvi djvulibre-bin python-boto python-tz Les NOUVEAUX paquets suivants seront installés : mc 0 mis à jour, 1 nouvellement installés, 0 à enlever et 160 non mis à jour. Il est nécessaire de prendre 0 o/2 173 ko dans les archives. Après cette opération, 6 603 ko d'espace disque supplémentaires seront utilisés. Sélection du paquet mc précédemment désélectionné. (Lecture de la base de données... 130287 fichiers et répertoires déjà installés.) Dépaquetage de mc (à partir de .../mc_3%3a4.7.0.9-1_i386.deb) ... Traitement des actions différées (« triggers ») pour « man-db »... Traitement des actions différées (« triggers ») pour « menu »... Paramétrage de mc (3:4.7.0.9-1) ... update-alternatives: utilisation de « /usr/bin/mcview » pour fournir « /usr/bin/view » (view) en mode automatique. Traitement des actions différées (« triggers ») pour « menu »...
La ré-installation d'un paquet est effectuée un utilisant la commande suivante :
root@debian:~# apt-get --reinstall install mc Lecture des listes de paquets... Fait Construction de l'arbre des dépendances Lecture des informations d'état... Fait 0 mis à jour, 0 nouvellement installés, 1 réinstallés, 0 à enlever et 160 non mis à jour. Il est nécessaire de prendre 0 o/2 173 ko dans les archives. Après cette opération, 0 o d'espace disque supplémentaires seront utilisés. (Lecture de la base de données... 130511 fichiers et répertoires déjà installés.) Préparation du remplacement de mc 3:4.7.0.9-1 (en utilisant .../mc_3%3a4.7.0.9-1_i386.deb) ... Dépaquetage de la mise à jour de mc ... Traitement des actions différées (« triggers ») pour « man-db »... Traitement des actions différées (« triggers ») pour « menu »... Paramétrage de mc (3:4.7.0.9-1) ... Traitement des actions différées (« triggers ») pour « menu »...
La suppression complète d'un paquetage, y compris les fichiers de configuration éventuellement modifiés est effectuée un utilisant la commande suivante :
root@debian:~# apt-get --purge remove mc Lecture des listes de paquets... Fait Construction de l'arbre des dépendances Lecture des informations d'état... Fait Les paquets suivants seront ENLEVÉS : mc* 0 mis à jour, 0 nouvellement installés, 1 à enlever et 160 non mis à jour. Après cette opération, 6 603 ko d'espace disque seront libérés. Souhaitez-vous continuer [O/n] ? o (Lecture de la base de données... 130510 fichiers et répertoires déjà installés.) Suppression de mc ... update-alternatives: utilisation de « /usr/bin/vim.tiny » pour fournir « /usr/bin/view » (view) en mode automatique. Purge des fichiers de configuration de mc ... Traitement des actions différées (« triggers ») pour « menu »... Traitement des actions différées (« triggers ») pour « man-db »...
Les paquets téléchargés d'une source distante ou via une source copy:// sont stockés dans le répertoire /var/cache/apt/archives. Les paquets partiellement téléchargés ou copiés sont stockés dans le répertoire /var/cache/apt/archives/partial.
root@debian:~# ls /var/cache/apt/archives/ lock mc_3%3a4.7.0.9-1_i386.deb partial
Pour nettoyer le cache il convient d'utiliser la commande suivante :
root@debian:~# apt-get clean root@debian:~# ls /var/cache/apt/archives/ lock partial
Pour mettre à jour les paquets déjà installés, il convient d'utiliser une de deux commandes apt-get :
- upgrade,
- dist-upgrade.
La deuxième commande met à jour une distribution complète, c'est-à-dire d'installer les mises à jour des paquets déjà installés et installer des nouveaux paquets ainsi que leur dépendances.
Mettez à jour donc votre distribution :
root@debian:~# apt-get dist-upgrade Lecture des listes de paquets... Fait Construction de l'arbre des dépendances Lecture des informations d'état... Fait Calcul de la mise à jour... Fait Les paquets suivants seront mis à jour : acpid apache2.2-bin apt apt-listchanges apt-utils aptitude base-files bind9-host ca-certificates cups cups-bsd cups-client cups-common cups-ppdc dbus dbus-x11 dnsutils dpkg e2fslibs e2fsprogs evince evince-common foo2zjs gdebi gdebi-core gdm3 gnome-settings-daemon google-chrome-stable grub-common grub-pc host iceweasel isc-dhcp-client isc-dhcp-common klibc-utils libapr1 libavcodec52 libavformat52 libavutil49 libbind9-60 libbrlapi0.5 libburn4 libcomerr2 libcups2 libcupscgi1 libcupsdriver1 libcupsimage2 libcupsmime1 libcupsppdc1 libcurl3 libcurl3-gnutls libdbus-1-3 libdns69 libevince2 libfreetype6 libgl1-mesa-dri libgl1-mesa-glx libglu1-mesa libgssapi-krb5-2 libgssrpc4 libisc62 libisccc60 libisccfg62 libk5crypto3 libkadm5clnt-mit7 libkadm5srv-mit7 libkdb5-4 libklibc libkrb5-3 libkrb5support0 libldap-2.4-2 liblwres60 libmms0 libmozjs2d libnss3-1d libpam-modules libpam-runtime libpam0g libpcap0.8 libperl5.10 libpng12-0 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libpostproc51 libsmbclient libsndfile1 libss2 libssl0.9.8 libswscale0 libtiff4 libvte-common libvte9 libwbclient0 libxfont1 libxml2 libxml2-utils linux-base linux-headers-2.6.32-5-686 linux-headers-2.6.32-5-common linux-image-2.6.32-5-686 linux-libc-dev mesa-utils openoffice.org openoffice.org-base openoffice.org-base-core openoffice.org-calc openoffice.org-common openoffice.org-core openoffice.org-draw openoffice.org-emailmerge openoffice.org-evolution openoffice.org-filter-binfilter openoffice.org-filter-mobiledev openoffice.org-gcj openoffice.org-gnome openoffice.org-gtk openoffice.org-help-en-us openoffice.org-help-fr openoffice.org-impress openoffice.org-java-common openoffice.org-l10n-fr openoffice.org-math openoffice.org-officebean openoffice.org-report-builder-bin openoffice.org-style-galaxy openoffice.org-style-tango openoffice.org-writer openssh-client openssl perl perl-base perl-modules policykit-1 python-apt python-apt-common python-brlapi python-libxml2 python-uno python-vte sun-java6-bin sun-java6-fonts sun-java6-jdk sun-java6-jre sun-java6-plugin system-tools-backends ttf-opensymbol tzdata uno-libs3 update-inetd ure usbutils x11-common xbase-clients xorg xserver-xorg xserver-xorg-input-all xserver-xorg-video-all xserver-xorg-video-tseng xulrunner-1.9.1 160 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour. Il est nécessaire de prendre 374 Mo dans les archives. Après cette opération, 14,2 Mo d'espace disque supplémentaires seront utilisés. Souhaitez-vous continuer [O/n] ? o
<note> Répondez o à la question Souhaitez-vous continuer [O/n] ?. Pendant la mise à jour de votre système, consultez l'APT HOWTO pour vous renseigner sur les autres commandes et options. </note>
<note important> Si le processus de mise à jour s'arrête en affichant une page d'information dans la console, appuyez sur la touche Q. Si le paquet grub est mis à jour, à la question qui est posée, répondez /dev/sda et validez. </note>
La commande apt-cache
La commande apt-cache permet de se renseigner sur les paquetages connus à APT.
La commande apt-get prend la forme suivante :
# apt-cache <options> <commande> <paquet(s)> [Entrée]
Les options et les commandes de la commande apt-cache sont :
root@debian:~# apt-cache --help apt 0.8.10.3 pour i386 compilé sur Apr 15 2011 21:02:14 Usage : apt-cache [options] commande apt-cache [options] add fichier1 [fichier2 ...] apt-cache [options] showpkg pkg1 [pkg2 ...] apt-cache [options] showsrc pkg1 [pkg2 ...] apt-cache est un outil de bas niveau pour manipuler les fichiers de cache pour les binaires, et pour en obtenir des informations. Commandes : add - Ajoute un paquet au cache source gencaches - Construit le cache des sources et celui des binaires showpkg - Affiche quelques informations générales pour un unique paquet showsrc - Affiche les enregistrements des sources stats - Affiche quelques statistiques de base dump - Affiche la totalité des fichiers dans un formulaire succinct dumpavail - Affiche une liste de fichiers disponibles sur la sortie standard unmet - Affiche les dépendances manquantes search - Cherche une expression rationnelle dans la liste des paquets show - Affiche la description du paquet showauto - Affiche la liste des paquets installés automatiquement depends - Affiche toutes les dépendances d'un paquet rdepends - Affiche les dépendances inverses d'un paquet pkgnames - Liste le nom de tous les paquets du système dotty - Génère un graphe des paquets pour GraphViz xvcg - Génère un graphe des paquets pour xvcg policy - Affiche l'étiquetage (Pin) en vigueur Options : -h Ce texte d'aide -p=? Le cache des paquets -s=? Le cache des sources -q Enlève l'indicateur de progression -i Affiche seulement les dépendances importantes pour la commande « unmet » -c=? Lit ce fichier de configuration -o=? Spécifie une option de configuration, p. ex. -o dir::cache=/tmp Regardez les pages de manuel de apt-cache(8) et apt.conf(5) pour plus d'informations.
Utilisation
Les commandes les plus utilisées d'apt-cache sont :
Commande | Description |
---|---|
stats | Affiche quelques statistiques de base. |
search | Cherche une expression rationnelle dans la liste des paquets. |
show | Affiche la description du paquet. |
depends | Affiche toutes les dépendances d'un paquet. |
T.P.#2
Utilisez la commande stats de la commande apt-cache pour obtenir des statistiques sur les paquets :
root@debian:~# apt-get stats E: L'opération stats n'est pas valable root@debian:~# apt-cache stats Nombre total de paquets : 38582 (772 k) Nombre total de structures de paquets : 38582 (1 852 k) Paquets ordinaires : 29199 Paquets entièrement virtuels : 561 Paquets virtuels simples : 3176 Paquets virtuels mixtes : 279 Manquants : 5367 Nombre de versions distinctes : 30965 (1 982 k) Nombre de descriptions distinctes : 35038 (841 k) Nombre de dépendances : 194525 (5 447 k) Nombre de relations version/fichier : 32586 (521 k) Nombre de relations description/fichier : 35038 (561 k) Nombre de relations « Provides » : 6646 (133 k) Nombre de motifs rationnels : 139 (1 552 ) Espace occupé par les versions des dépendances : 826 k Espace disque gaspillé : 71,3 k Total de l'espace attribué : 10,0 M
<note> Utilisez le manuel d'apt-cache pour trouver les définitions des termes Paquets ordinaires, Paquets entièrement virtuels, Paquets virtuels simples et Paquets virtuels mixtes. </note>
Recherchez maintenant la chaîne mc dans la liste des paquets :
root@debian:~# apt-cache search mc | more libcyrus-imap-perl22 - Interface to Cyrus imap client imclient library kolab-libcyrus-imap-perl - Kolab Interface to Cyrus imap client imclient library php5-mcrypt - MCrypt module for php5 libservlet2.5-java-doc - Servlet 2.5 and JSP 2.1 Java API documentation libservlet2.5-java - Servlet 2.5 and JSP 2.1 Java API classes libtomcat6-java - Servlet and JSP engine -- core libraries tomcat6-admin - Servlet and JSP engine -- admin web applications tomcat6-common - Servlet and JSP engine -- common files tomcat6-docs - Servlet and JSP engine -- documentation tomcat6-examples - Servlet and JSP engine -- example web applications tomcat6-user - Servlet and JSP engine -- tools to create user instances tomcat6 - Servlet and JSP engine libace-rmcast-5.7.7 - ACE reliable multicast library libace-rmcast-dev - ACE reliable multicast library development files libace-tmcast-5.7.7 - ACE transactional multicast library libace-tmcast-dev - ACE transactional multicast library development files amule-emc - lists ed2k links inside emulecollection files ap-utils - Access Point SNMP Utils for Linux apel - portable library for emacsen ardour - digital audio workstation (graphical gtk2 interface) python-beaker - cache and session library python3-beaker - cache and session library for Python 3 libcbf-dev - development files for CBFlib --More--
Pour être plus précis dans la recherche, il est nécessaire de rechercher une phrase clef :
root@debian:~# apt-cache search "midnight commander" avfs - virtual filesystem to access archives, disk images, remote locations gnome-commander - nice and fast file manager for the GNOME desktop krusader - twin-panel (commander-style) file manager mc-dbg - Midnight Commander - a powerful file manager - debug package mc - Midnight Commander - a powerful file manager moc - ncurses based console audio player junior-system - Outils systèmes Debian Jr. pilot - Navigateur simple de fichiers pour Alpine, client de courriel en mode texte
Afficher maintenant les informations concernant le paquet mc :
root@debian:~# apt-cache show mc Package: mc Priority: optional Section: utils Installed-Size: 6448 Maintainer: Debian MC Packaging Group <pkg-mc-devel@lists.alioth.debian.org> Architecture: i386 Version: 3:4.7.0.9-1 Depends: e2fslibs (>= 1.41.0), libc6 (>= 2.3.6-6~), libcomerr2 (>= 1.01), libglib2.0-0 (>= 2.24.0), libgpm2 (>= 1.20.4), libslang2 (>= 2.0.7-1) Recommends: mime-support Suggests: perl, zip, unzip, bzip2, links | w3m | lynx, arj, file, xpdf-reader | pdf-viewer, dbview, odt2txt, gv, catdvi, djvulibre-bin, imagemagick, python, python-boto, python-tz Filename: pool/main/m/mc/mc_4.7.0.9-1_i386.deb Size: 2173372 MD5sum: fd42d47064972f7444fc992234bfa11d SHA1: bb6cb3422c26f566314992f6bddf17fd6dd03999 SHA256: 8d73b8ec3d75298de78fcf795afd55911a813b69fac65b140ed603992086bd40 Description: Midnight Commander - a powerful file manager GNU Midnight Commander is a text-mode full-screen file manager. It uses a two panel interface and a subshell for command execution. It includes an internal editor with syntax highlighting and an internal viewer with support for binary files. Also included is Virtual Filesystem (VFS), that allows files on remote systems (e.g. FTP, SSH servers) and files inside archives to be manipulated like real files. Homepage: http://www.midnight-commander.org Tag: role::program, scope::application, suite::gnu, uitoolkit::ncurses, use::browsing, use::organizing, works-with::file
Dernièrement, visualisez les dépendances du paquet mc :
root@debian:~# apt-cache depends mc mc Dépend: e2fslibs Dépend: libc6 Dépend: libcomerr2 Dépend: libglib2.0-0 Dépend: libgpm2 Dépend: libslang2 Suggère: perl Suggère: zip Suggère: unzip Suggère: bzip2 |Suggère: links |Suggère: w3m Suggère: lynx Suggère: arj Suggère: file |Suggère: xpdf-reader Suggère: <pdf-viewer> epdfview evince evince-gtk gv okular viewpdf.app xpdf zathura Suggère: dbview Suggère: odt2txt Suggère: gv Suggère: catdvi Suggère: djvulibre-bin Suggère: imagemagick graphicsmagick-imagemagick-compat Suggère: python Suggère: python-boto Suggère: python-tz Recommande: mime-support
Version: 2020/01/30 03:28
Les Bibliothèques Partagées
Présentation
Introduction
Les bibliothèques partagées sont des fonctions communes à plusieurs programmes différents d'un même domaine (son, base de données, vidéo etc.). Les fonctions proposées par une ou plusieurs bibliothèques forment un API (Application Programming Interface). Sous Linux les bibliothèques se nomment Shared Objects et portent le suffixe .so.
Stockage
Les bibliothèques partagées sont stockées par convention dans des répertoires lib, par exemple :
Répertoire | Contenu |
---|---|
/lib | Bibliothèques du système de base |
/usr/lib | Bibliothèques utilisateurs |
/usr/local/lib | Bibliothèques locales |
/usr/X11R6/lib | Bibliothèques de l'environnement X |
/opt/kde4/lib | Bibliothèques de KDE |
<note important> La bibliothèque la plus importante est libc. Sans elle, le système Linux ne peut pas fonctionner. </note>
ld-linux.so.2
La bibliothèque ld-linux.so.2 est utilisée par le système pour créer un lien avec une bibliothèque partagée au moment de l'exécution d'un programme et s'appelle le chargeur de liens. Ce dernier recherche des bibliothèques partagées dans un ordre précis :
- dans les chemins précisés par la variable système LD_LIBRARY_PATH,
- dans les chemins précisés dans le contenu compilé du fichier /etc/ld.so.cache,
- dans /lib et /usr/lib.
Il est à noter que le contenu du cache ld.so.cache est construit à partir des informations contenus dans le fichier de configuration /etc/ld.so.conf.
Afin d'étudier les bibliothèques liées à une application, nous allons d'abord installer l'application mc, un explorateur de fichiers en mode console :
root@debian:~# apt-get install mc Lecture des listes de paquets... Fait Construction de l'arbre des dépendances Lecture des informations d'état... Fait Paquets suggérés : zip arj dbview odt2txt gv catdvi djvulibre-bin python-boto python-tz Les NOUVEAUX paquets suivants seront installés : mc 0 mis à jour, 1 nouvellement installés, 0 à enlever et 219 non mis à jour. Il est nécessaire de prendre 2 173 ko dans les archives. Après cette opération, 6 603 ko d'espace disque supplémentaires seront utilisés. Réception de : 1 http://ftp.fr.debian.org/debian/ squeeze/main mc i386 3:4.7.0.9-1 [2 173 kB] 2 173 ko réceptionnés en 34s (62,2 ko/s) Sélection du paquet mc précédemment désélectionné. (Lecture de la base de données... 130292 fichiers et répertoires déjà installés.) Dépaquetage de mc (à partir de .../mc_3%3a4.7.0.9-1_i386.deb) ... Traitement des actions différées (« triggers ») pour « man-db »... Traitement des actions différées (« triggers ») pour « menu »... Paramétrage de mc (3:4.7.0.9-1) ... update-alternatives: utilisation de « /usr/bin/mcview » pour fournir « /usr/bin/view » (view) en mode automatique. Traitement des actions différées (« triggers ») pour « menu »...
La Commande ldd
Pour déterminer quelles sont les bibliothèques liées à une application, il convient d'utiliser la commande ldd :
root@debian:~# ldd /usr/bin/mc linux-gate.so.1 => (0xb7821000) libslang.so.2 => /lib/libslang.so.2 (0xb7715000) libext2fs.so.2 => /lib/libext2fs.so.2 (0xb76eb000) libcom_err.so.2 => /lib/libcom_err.so.2 (0xb76e7000) libgpm.so.2 => /usr/lib/libgpm.so.2 (0xb76e1000) libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb76dd000) librt.so.1 => /lib/librt.so.1 (0xb76d4000) libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0xb760b000) libpthread.so.0 => /lib/libpthread.so.0 (0xb75f2000) libc.so.6 => /lib/libc.so.6 (0xb74ac000) libdl.so.2 => /lib/libdl.so.2 (0xb74a8000) libm.so.6 => /lib/libm.so.6 (0xb7482000) /lib/ld-linux.so.2 (0xb7822000) libpcre.so.3 => /lib/libpcre.so.3 (0xb744f000)
Afin de comprendre ce qui se passe dans le cas où une bibliothèque est manquante, renommez la bibliothèque /usr/lib/libgpm.so.2 en /usr/lib/libgpm.so.2.old :
root@debian:~# mv /usr/lib/libgpm.so.2 /usr/lib/libgpm.so.2.old
Exécutez de nouveau la commande ldd. Vous obtiendrez un résultat similaire à celui-ci :
root@debian:~# ldd /usr/bin/mc linux-gate.so.1 => (0xb771b000) libslang.so.2 => /lib/libslang.so.2 (0xb760f000) libext2fs.so.2 => /lib/libext2fs.so.2 (0xb75e5000) libcom_err.so.2 => /lib/libcom_err.so.2 (0xb75e1000) libgpm.so.2 => not found libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb75dd000) librt.so.1 => /lib/librt.so.1 (0xb75d4000) libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0xb750b000) libpthread.so.0 => /lib/libpthread.so.0 (0xb74f1000) libc.so.6 => /lib/libc.so.6 (0xb73ac000) libdl.so.2 => /lib/libdl.so.2 (0xb73a8000) libm.so.6 => /lib/libm.so.6 (0xb7382000) /lib/ld-linux.so.2 (0xb771c000) libpcre.so.3 => /lib/libpcre.so.3 (0xb734f000)
Notez la présence de la ligne libgpm.so.2 ⇒ not found. Compte tenu de la bibliothèque partagée manquante, le programme mc ne peut plus être lancé :
root@debian:~# mc mc: error while loading shared libraries: libgpm.so.2: cannot open shared object file: No such file or directory
Renommez la bibliothèque correctement et vérifiez la résolution de l'erreur précédente avec la commande ldd :
root@debian:~# mv /usr/lib/libgpm.so.2.old /usr/lib/libgpm.so.2 root@debian:~# ldd /usr/bin/mc linux-gate.so.1 => (0xb784b000) libslang.so.2 => /lib/libslang.so.2 (0xb773f000) libext2fs.so.2 => /lib/libext2fs.so.2 (0xb7715000) libcom_err.so.2 => /lib/libcom_err.so.2 (0xb7711000) libgpm.so.2 => /usr/lib/libgpm.so.2 (0xb770b000) libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb7707000) librt.so.1 => /lib/librt.so.1 (0xb76fe000) libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0xb7635000) libpthread.so.0 => /lib/libpthread.so.0 (0xb761c000) libc.so.6 => /lib/libc.so.6 (0xb74d6000) libdl.so.2 => /lib/libdl.so.2 (0xb74d2000) libm.so.6 => /lib/libm.so.6 (0xb74ac000) /lib/ld-linux.so.2 (0xb784c000) libpcre.so.3 => /lib/libpcre.so.3 (0xb7479000)
Le fichier /etc/ld.so.conf
Le fichier /etc/ld.so.conf est utilisé pour configurer le cache /etc/ld.so.cache :
root@debian:~# cat /etc/ld.so.conf include /etc/ld.so.conf.d/*.conf
Dans ce cas, le fichier ne contient qu'une directive include qui renvoie vers le contenu du répertoire /etc/ld.so.conf.d/ :
root@debian:~# ls -l /etc/ld.so.conf.d/ total 8 -rw-r--r-- 1 root root 64 24 janv. 2011 i486-linux-gnu.conf -rw-r--r-- 1 root root 44 23 janv. 2011 libc.conf
Le contenu de ces deux fichiers est le suivant :
root@debian:~# cat /etc/ld.so.conf.d/i486-linux-gnu.conf # Multiarch support /lib/i486-linux-gnu /usr/lib/i486-linux-gnu
root@debian:~# cat /etc/ld.so.conf.d/libc.conf # libc default configuration /usr/local/lib
La Commande ldconfig
La commande ldconfig est utilisée pour :
- mettre à jour le cache pour les chemins inclus dans le fichier /etc/ld.so.conf ainsi que pour les répertoires /lib et /usr/lib. L'option -N de la commande ldconfig empêche la mise à jour des chemins dans le fichier,
- mettre à jour les liens symboliques sur les bibliothèques. L'option -X de la commande ldconfig empêche la mise à jour des liens symboliques.
Les liens symboliques sont utilisés pour gérer les versions de bibliothèques.
La commande ldconfig peut être utilisée avec l'option -p pour visualiser le contenu du cache :
root@debian:~# ldconfig -p | more 752 libs trouvé dans le cache « /etc/ld.so.cache » libzbar.so.0 (libc6) => /usr/lib/libzbar.so.0 libz.so.1 (libc6) => /usr/lib/libz.so.1 libx86.so.1 (libc6) => /lib/libx86.so.1 libxtables.so.4 (libc6) => /lib/libxtables.so.4 libxslt.so.1 (libc6) => /usr/lib/libxslt.so.1 libxml2.so.2 (libc6) => /usr/lib/libxml2.so.2 libxmi.so.0 (libc6) => /usr/lib/libxmi.so.0 libxklavier.so.16 (libc6) => /usr/lib/libxklavier.so.16 libxkbfile.so.1 (libc6) => /usr/lib/libxkbfile.so.1 libxdot.so.4 (libc6) => /usr/lib/libxdot.so.4 libxcb.so.1 (libc6) => /usr/lib/libxcb.so.1 libxcb-render.so.0 (libc6) => /usr/lib/libxcb-render.so.0 libxcb-render-util.so.0 (libc6) => /usr/lib/libxcb-render-util.so.0 libxcb-event.so.1 (libc6) => /usr/lib/libxcb-event.so.1 libxcb-dri2.so.0 (libc6) => /usr/lib/libxcb-dri2.so.0 libxcb-aux.so.0 (libc6) => /usr/lib/libxcb-aux.so.0 libxcb-atom.so.1 (libc6) => /usr/lib/libxcb-atom.so.1 libxapian.so.22 (libc6, hwcap: 0x0000000004000000) => /usr/lib/sse2/libxapian.so.22 libxapian.so.22 (libc6) => /usr/lib/libxapian.so.22 libwrap.so.0 (libc6) => /lib/libwrap.so.0 libwps-0.1.so.1 (libc6) => /usr/lib/libwps-0.1.so.1 libwps-stream-0.1.so.1 (libc6) => /usr/lib/libwps-stream-0.1.so.1 --More--
Pour ajouter des bibliothèques partagées, il convient de :
- créer un fichier dans le répertoire /etc/ld.so.conf.d/ et d'y inscrire le ou les chemins vers le lieu de stockage des bibliothèques partagées à ajouter,
- exécuter la commande ldconfig -v, où v implique verbose, afin de reconstruire le cache.
~~DISCUSSION:off~~
Donner votre Avis
{(rater>id=debian_6_l107|name=cette page|type=rate|trace=user|tracedetails=1)}