Ceci est une ancienne révision du document !
Table des matières
Version : 2022.01
Dernière mise-à-jour : 2022/04/29 07:57
LDF502 - Gestion des Paquets
Contenu du Module
- LRF502 - Gestion des Paquets
- Contenu du Module
- LAB #1 - Compiler à partir des sources
- 1.1 - ./configure
- 1.2 - make
- 1.3 - make check
- 1.4 - make install
- LAB#2 - Utilisation de la Commande dpkg
- 2.1 - Configuration
- 2.2 - Utilisation
- LAB#3 - Utilisation de la Commande dselect
- LAB#4 - Utilisation de la Commande apt-get
- 4.1 - Configuration
- 4.2 - Dépôts
- 4.3 - Utilisation
- LAB #5 - Utilisation de la Commande apt-cache
- Les Bibliothèques Partagées
- Présentation
- Introduction
- Stockage
- ld-linux.so.2
- La Commande ldd
- Le fichier /etc/ld.so.conf
- La Commande ldconfig
LAB #1 - Compiler à partir des sources
Historiquement il était nécessaire d'installer un logiciel à partir de ses fichiers sources.
Pour commencer, installez les outils dont vous aurez besoin :
root@debian11:~# apt-get -y install gcc
Pour comprendre ce qui est la compilation d'un logiciel, commencez par télécharger le logiciel hello :
root@debian11:~# wget --no-check-certificate https://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz --2022-04-25 13:38:57-- https://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz Resolving ftp.gnu.org (ftp.gnu.org)... 209.51.188.20, 2001:470:142:3::b Connecting to ftp.gnu.org (ftp.gnu.org)|209.51.188.20|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 389363 (380K) [application/x-gzip] Saving to: ‘hello-2.1.1.tar.gz’ hello-2.1.1.tar.gz 100%[====================================================================================================================>] 380.24K 864KB/s in 0.4s 2022-04-25 13:38:58 (864 KB/s) - ‘hello-2.1.1.tar.gz’ saved [389363/389363]
Ensuite désarchivez le logiciel :
root@debian11:~# tar xvf hello-2.1.1.tar.gz
Changez de répertoire :
root@debian11:~# cd hello-2.1.1/ root@debian11:~/hello-2.1.1# ls ABOUT-NLS AUTHORS ChangeLog config.guess config.rpath configure contrib depcomp INSTALL intl Makefile.am man mkinstalldirs po src THANKS aclocal.m4 BUGS ChangeLog.O config.h.in config.sub configure.ac COPYING doc install-sh m4 Makefile.in missing NEWS README tests TODO
A l'étude du fichier README, celui-ci nous renvoie vers le fichier INSTALL :
root@debian11:~/hello-2.1.1# cat README
We are pleased to announce the version 2.1 release of GNU Hello.
All reported bugs in previous test releases have been fixed.
Some bugs surely remain.
The GNU implementation of this classic program is brought to you by
the efforts of several people, including Mike Haertel, David MacKenzie,
Jan Brittenson, Roland McGrath, Charles Hannum, and The King.
The basic algorithm is described in: "The C Programming Language", by
B. W. Kernighan and D. M. Ritchie, Prentice-Hall, New Jersey, 1978;
the program is an enhancement of the one published in that book.
See the file INSTALL for building and installation instructions.
Please send all bug reports by electronic mail to:
bug-gnu-hello@gnu.org
GNU Hello is free software. See the file COPYING for copying conditions.
Visualisez donc ce dernier :
root@debian11:~/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
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
--More--(26%)
[q] <<<<<<<<<<<< Appuyez sur la touche q
La procédure expliquée est celle utilisée pour la plupart des installations manuelles, à savoir la saisie des quatre commandes suivantes.
1.1 - ./configure
Important : configure est un script chargé de créer les makefiles pour une architecture donnée. Les makefiles sont lus par la commande make.
root@debian11:~/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}... no
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... none
checking dependency style of gcc... none
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... x86_64-unknown-linux
checking host system type... x86_64-unknown-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
1.2 - make
Important : make sert à appeler des commandes créant des fichiers nécessaires à l'installation du logiciel.
Notez que la commande make n'est pas installée. Installez la commande :
root@debian11:~/hello-2.1.1# make -bash: make: command not found root@debian11:~/hello-2.1.1# which make root@debian11:~/hello-2.1.1# apt install y make
Exécutez maintenant la commande make :
root@debian11:~/hello-2.1.1# make make all-recursive make[1]: Entering directory '/root/hello-2.1.1' Making all in contrib make[2]: Entering directory '/root/hello-2.1.1/contrib' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/root/hello-2.1.1/contrib' Making all in doc make[2]: Entering directory '/root/hello-2.1.1/doc' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/root/hello-2.1.1/doc' Making all in intl make[2]: Entering directory '/root/hello-2.1.1/intl' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/root/hello-2.1.1/intl' Making all in po make[2]: Entering directory '/root/hello-2.1.1/po' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/root/hello-2.1.1/po' Making all in src make[2]: Entering directory '/root/hello-2.1.1/src' source='hello.c' object='hello.o' libtool=no \ depfile='.deps/hello.Po' tmpdepfile='.deps/hello.TPo' \ depmode=none /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=none /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=none /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=none /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]: Leaving directory '/root/hello-2.1.1/src' Making all in man make[2]: Entering directory '/root/hello-2.1.1/man' perl help2man --name="Friendly Greeting Program" ../src/hello >hello.1 make[2]: Leaving directory '/root/hello-2.1.1/man' Making all in m4 make[2]: Entering directory '/root/hello-2.1.1/m4' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/root/hello-2.1.1/m4' Making all in tests make[2]: Entering directory '/root/hello-2.1.1/tests' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/root/hello-2.1.1/tests' make[2]: Entering directory '/root/hello-2.1.1' make[2]: Leaving directory '/root/hello-2.1.1' make[1]: Leaving directory '/root/hello-2.1.1'
1.3 - make check
Important : make check permet de vérifier si la commande make a bien fonctionné.
root@debian11:~/hello-2.1.1# make check Making check in contrib make[1]: Entering directory '/root/hello-2.1.1/contrib' make[1]: Nothing to be done for 'check'. make[1]: Leaving directory '/root/hello-2.1.1/contrib' Making check in doc make[1]: Entering directory '/root/hello-2.1.1/doc' make[1]: Nothing to be done for 'check'. make[1]: Leaving directory '/root/hello-2.1.1/doc' Making check in intl make[1]: Entering directory '/root/hello-2.1.1/intl' make[1]: Nothing to be done for 'check'. make[1]: Leaving directory '/root/hello-2.1.1/intl' Making check in po make[1]: Entering directory '/root/hello-2.1.1/po' make[1]: Nothing to be done for 'check'. make[1]: Leaving directory '/root/hello-2.1.1/po' Making check in src make[1]: Entering directory '/root/hello-2.1.1/src' make[1]: Nothing to be done for 'check'. make[1]: Leaving directory '/root/hello-2.1.1/src' Making check in man make[1]: Entering directory '/root/hello-2.1.1/man' make[1]: Nothing to be done for 'check'. make[1]: Leaving directory '/root/hello-2.1.1/man' Making check in m4 make[1]: Entering directory '/root/hello-2.1.1/m4' make[1]: Nothing to be done for 'check'. make[1]: Leaving directory '/root/hello-2.1.1/m4' Making check in tests make[1]: Entering directory '/root/hello-2.1.1/tests' make check-TESTS make[2]: Entering directory '/root/hello-2.1.1/tests' PASS: hello-1 PASS: world-1 PASS: nothing-1 ================== All 3 tests passed ================== make[2]: Leaving directory '/root/hello-2.1.1/tests' make[1]: Leaving directory '/root/hello-2.1.1/tests' make[1]: Entering directory '/root/hello-2.1.1' make[1]: Leaving directory '/root/hello-2.1.1'
1.4 - make install
Important : make install sert à installer le logiciel.
root@debian11:~/hello-2.1.1# make install
Making install in contrib
make[1]: Entering directory '/root/hello-2.1.1/contrib'
make[2]: Entering directory '/root/hello-2.1.1/contrib'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/hello-2.1.1/contrib'
make[1]: Leaving directory '/root/hello-2.1.1/contrib'
Making install in doc
make[1]: Entering directory '/root/hello-2.1.1/doc'
make[2]: Entering directory '/root/hello-2.1.1/doc'
make[2]: Nothing to be done for '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
make[2]: Leaving directory '/root/hello-2.1.1/doc'
make[1]: Leaving directory '/root/hello-2.1.1/doc'
Making install in intl
make[1]: Entering directory '/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]: Leaving directory '/root/hello-2.1.1/intl'
Making install in po
make[1]: Entering directory '/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]: Leaving directory '/root/hello-2.1.1/po'
Making install in src
make[1]: Entering directory '/root/hello-2.1.1/src'
make[2]: Entering directory '/root/hello-2.1.1/src'
/bin/bash ../mkinstalldirs /usr/local/bin
/usr/bin/install -c hello /usr/local/bin/hello
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/hello-2.1.1/src'
make[1]: Leaving directory '/root/hello-2.1.1/src'
Making install in man
make[1]: Entering directory '/root/hello-2.1.1/man'
make[2]: Entering directory '/root/hello-2.1.1/man'
make[2]: Nothing to be done for '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]: Leaving directory '/root/hello-2.1.1/man'
make[1]: Leaving directory '/root/hello-2.1.1/man'
Making install in m4
make[1]: Entering directory '/root/hello-2.1.1/m4'
make[2]: Entering directory '/root/hello-2.1.1/m4'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/hello-2.1.1/m4'
make[1]: Leaving directory '/root/hello-2.1.1/m4'
Making install in tests
make[1]: Entering directory '/root/hello-2.1.1/tests'
make[2]: Entering directory '/root/hello-2.1.1/tests'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/hello-2.1.1/tests'
make[1]: Leaving directory '/root/hello-2.1.1/tests'
make[1]: Entering directory '/root/hello-2.1.1'
make[2]: Entering directory '/root/hello-2.1.1'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/hello-2.1.1'
make[1]: Leaving directory '/root/hello-2.1.1'
Il convient maintenant de tester le nouveau logiciel :
root@debian11:~/hello-2.1.1# hello Hello, world!
Le logiciel hello a été correctement installé.
LAB #2 - Utilisation de la Commande dpkg
Placez-vous dans le répertoire personnel de root grâce à la commande cd ~ :
root@debian11:~/hello-2.1.1# cd ~ root@debian11:~# pwd /root
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@debian11:~# dpkg --help
Usage: dpkg [<option>...] <command>
Commands:
-i|--install <.deb file name>... | -R|--recursive <directory>...
--unpack <.deb file name>... | -R|--recursive <directory>...
-A|--record-avail <.deb file name>... | -R|--recursive <directory>...
--configure <package>... | -a|--pending
--triggers-only <package>... | -a|--pending
-r|--remove <package>... | -a|--pending
-P|--purge <package>... | -a|--pending
-V|--verify [<package>...] Verify the integrity of package(s).
--get-selections [<pattern>...] Get list of selections to stdout.
--set-selections Set package selections from stdin.
--clear-selections Deselect every non-essential package.
--update-avail [<Packages-file>] Replace available packages info.
--merge-avail [<Packages-file>] Merge with info from file.
--clear-avail Erase existing available info.
--forget-old-unavail Forget uninstalled unavailable pkgs.
-s|--status [<package>...] Display package status details.
-p|--print-avail [<package>...] Display available version details.
-L|--listfiles <package>... List files 'owned' by package(s).
-l|--list [<pattern>...] List packages concisely.
-S|--search <pattern>... Find package(s) owning file(s).
-C|--audit [<package>...] Check for broken package(s).
--yet-to-unpack Print packages selected for installation.
--predep-package Print pre-dependencies to unpack.
--add-architecture <arch> Add <arch> to the list of architectures.
--remove-architecture <arch> Remove <arch> from the list of architectures.
--print-architecture Print dpkg architecture.
--print-foreign-architectures Print allowed foreign architectures.
--assert-<feature> Assert support for the specified feature.
--validate-<thing> <string> Validate a <thing>'s <string>.
--compare-versions <a> <op> <b> Compare version numbers - see below.
--force-help Show help on forcing.
-Dh|--debug=help Show help on debugging.
-?, --help Show this help message.
--version Show the version.
Assertable features: support-predepends, working-epoch, long-filenames,
multi-conrep, multi-arch, versioned-provides, protected-field.
Validatable things: pkgname, archname, trigname, version.
Use dpkg with -b, --build, -c, --contents, -e, --control, -I, --info,
-f, --field, -x, --extract, -X, --vextract, --ctrl-tarfile, --fsys-tarfile
on archives (type dpkg-deb --help).
Options:
--admindir=<directory> Use <directory> instead of /var/lib/dpkg.
--root=<directory> Install on a different root directory.
--instdir=<directory> Change installation dir without changing admin dir.
--pre-invoke=<command> Set a pre-invoke hook.
--post-invoke=<command> Set a post-invoke hook.
--path-exclude=<pattern> Do not install paths which match a shell pattern.
--path-include=<pattern> Re-include a pattern after a previous exclusion.
-O|--selected-only Skip packages not selected for install/upgrade.
-E|--skip-same-version Skip packages whose same version is installed.
-G|--refuse-downgrade Skip packages with earlier version than installed.
-B|--auto-deconfigure Install even if it would break some other package.
--[no-]triggers Skip or force consequential trigger processing.
--verify-format=<format> Verify output format (supported: 'rpm').
--no-pager Disables the use of any pager.
--no-debsig Do not try to verify package signatures.
--no-act|--dry-run|--simulate
Just say what we would do - don't do it.
-D|--debug=<octal> Enable debugging (see -Dhelp or --debug=help).
--status-fd <n> Send status change updates to file descriptor <n>.
--status-logger=<command> Send status change updates to <command>'s stdin.
--log=<filename> Log status changes and actions to <filename>.
--ignore-depends=<package>[,...]
Ignore dependencies involving <package>.
--force-<thing>[,...] Override problems (see --force-help).
--no-force-<thing>[,...] Stop when problems encountered.
--refuse-<thing>[,...] Ditto.
--abort-after <n> Abort after encountering <n> errors.
--robot Use machine-readable output on some commands.
Comparison operators for --compare-versions are:
lt le eq ne ge gt (treat empty version as earlier than any version);
lt-nl le-nl ge-nl gt-nl (treat empty version as later than any version);
< << <= = >= >> > (only for compatibility with control file syntax).
Use 'apt' or 'aptitude' for user-friendly package management.
2.1 - Configuration
Le fichier de configuration proncipal de la commande dpkg est /etc/dpkg/dpkg.cfg :
root@debian11:~# 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
Les directives dans ce fichier sont les options de la commande dpkg sans les charactères –.
Il est important à noter que la base de données de la commande dpkg se trouve dans le répertoire /var/lib/dpkg :
root@debian11:~# ls -l /var/lib/dpkg total 2836 drwxr-xr-x 2 root root 4096 Apr 25 13:38 alternatives -rw-r--r-- 1 root root 121896 Apr 25 06:30 available -rw-r--r-- 1 root root 8 Apr 25 06:29 cmethopt -rw-r--r-- 1 root root 237 Apr 25 07:01 diversions -rw-r--r-- 1 root root 292 Apr 25 07:01 diversions-old drwxr-xr-x 2 root root 258048 Apr 25 13:45 info -rw-r----- 1 root root 0 Apr 25 13:45 lock -rw-r----- 1 root root 0 Apr 25 06:54 lock-frontend drwxr-xr-x 2 root root 4096 Apr 14 2021 parts -rw-r--r-- 1 root root 135 Apr 25 06:49 statoverride -rw-r--r-- 1 root root 100 Apr 25 06:48 statoverride-old -rw-r--r-- 1 root root 1239440 Apr 25 13:45 status -rw-r--r-- 1 root root 1239479 Apr 25 13:45 status-old drwxr-xr-x 2 root root 4096 Apr 25 06:52 triggers drwxr-xr-x 2 root root 4096 Apr 25 13:45 updates
Important - Il est recommendé d'inclure ce répertoire et son contenu dans les sauvegardes régulières.
2.2 - Utilisation
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@debian11:~# dpkg -l | more Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-=====================================-================================-============-======================================================================================================================= ii acl 2.2.53-10 amd64 access control list - utilities ii adduser 3.118 all add and remove users and groups ii adwaita-icon-theme 3.38.0-1 all default icon theme of GNOME ii alsa-topology-conf 1.2.4-1 all ALSA topology configuration files ii alsa-ucm-conf 1.2.4-2 all ALSA Use Case Manager configuration files ii alsa-utils 1.2.4-1 amd64 Utilities for configuring and using ALSA ii anacron 2.3-30 amd64 cron-like program that doesn't go by time ii apparmor 2.13.6-10 amd64 user-space parser utility for AppArmor ii apt 2.2.4 amd64 commandline package manager ii apt-listchanges 3.24 all package change history notification tool ii apt-utils 2.2.4 amd64 package management related utility programs ii aspell 0.60.8-3 amd64 GNU Aspell spell-checker ii aspell-en 2018.04.16-0-1 all English dictionary for GNU Aspell ii at-spi2-core 2.38.0-4 amd64 Assistive Technology Service Provider Interface (dbus core) ii atril 1.24.0-1 amd64 MATE document viewer ii atril-common 1.24.0-1 all MATE document viewer (common files) ii avahi-daemon 0.8-5 amd64 Avahi mDNS/DNS-SD daemon ii base-files 11.1+deb11u3 amd64 Debian base system miscellaneous files ii base-passwd 3.5.51 amd64 Debian base system master password and group files ii bash 5.1-2+b3 amd64 GNU Bourne Again SHell ii bash-completion 1:2.11-2 all programmable completion for the bash shell ii bc 1.07.1-2+b2 amd64 GNU bc arbitrary precision calculator language ii bind9-dnsutils 1:9.16.27-1~deb11u1 amd64 Clients provided with BIND 9 ii bind9-host 1:9.16.27-1~deb11u1 amd64 DNS Lookup Utility ii bind9-libs:amd64 1:9.16.27-1~deb11u1 amd64 Shared Libraries used by BIND 9 ii binutils 2.35.2-2 amd64 GNU assembler, linker and binary utilities ii binutils-common:amd64 2.35.2-2 amd64 Common files for the GNU assembler, linker and binary utilities ii binutils-x86-64-linux-gnu 2.35.2-2 amd64 GNU binary utilities, for x86-64-linux-gnu target ii bsdextrautils 2.36.1-8+deb11u1 amd64 extra utilities from 4.4BSD-Lite ii bsdutils 1:2.36.1-8+deb11u1 amd64 basic utilities from 4.4BSD-Lite ii bubblewrap 0.4.1-3 amd64 utility for unprivileged chroot and namespace manipulation ii busybox 1:1.30.1-6+b3 amd64 Tiny utilities for small and embedded systems ii bzip2 1.0.8-4 amd64 high-quality block-sorting file compressor - utilities ii ca-certificates 20210119 all Common CA certificates ii coinor-libcbc3:amd64 2.10.5+ds1-3 amd64 Coin-or branch-and-cut mixed integer programming solver (shared libraries) ii coinor-libcgl1 0.60.3+repack1-2 amd64 COIN-OR Cut Generation Library ii coinor-libclp1 1.17.5+repack1-1 amd64 Coin-or linear programming solver (shared libraries) ii coinor-libcoinmp1v5:amd64 1.8.3-3 amd64 Simple C API for COIN-OR Solvers Clp and Cbc -- library ii coinor-libcoinutils3v5 2.11.4+repack1-1 amd64 Coin-or collection of utility classes (binaries and libraries) ii coinor-libosi1v5:amd64 0.108.6+repack1-2 amd64 COIN-OR Open Solver Interface ii colord 1.4.5-3 amd64 system service to manage device colour profiles -- system daemon ii colord-data 1.4.5-3 all system service to manage device colour profiles -- data files ii console-setup 1.205 all console font and keymap setup program ii console-setup-linux 1.205 all Linux specific part of console-setup ii coreutils 8.32-4+b1 amd64 GNU core utilities ii cpio 2.13+dfsg-4 amd64 GNU cpio -- a program to manage archives of files ii cpp 4:10.2.1-1 amd64 GNU C preprocessor (cpp) ii cpp-10 10.2.1-6 amd64 GNU C preprocessor ii cron 3.0pl1-137 amd64 process scheduling daemon ii cups 2.3.3op2-3+deb11u1 amd64 Common UNIX Printing System(tm) - PPD/driver support, web interface ii cups-browsed 1.28.7-1+deb11u1 amd64 OpenPrinting CUPS Filters - cups-browsed ii cups-client 2.3.3op2-3+deb11u1 amd64 Common UNIX Printing System(tm) - client programs (SysV) ii cups-common 2.3.3op2-3+deb11u1 all Common UNIX Printing System(tm) - common files --More-- [q]
Important - L'option -l liste les paquets disponibles spécifiés par le fichier /var/lib/dpkg/available.
root@debian11:~# more /var/lib/dpkg/available Package: gcc-10-base Source: gcc-10 Version: 10.2.1-6 Installed-Size: 261 Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org> Architecture: amd64 Breaks: gnat (<< 7) Description: GCC, the GNU Compiler Collection (base package) Description-md5: b6e93638a6d08ea7a18929d7cf078e5d Multi-Arch: same Homepage: http://gcc.gnu.org/ Tag: role::shared-lib Section: libs Priority: required Filename: pool/main/g/gcc-10/gcc-10-base_10.2.1-6_amd64.deb Size: 201332 MD5sum: 8ad775342ca4fd0adca5a516849b6498 SHA256: be65535e94f95fbf04b104e8ab36790476f063374430f7dfc6c516cbe2d2cd1e Package: libgcc-s1 Source: gcc-10 Version: 10.2.1-6 Installed-Size: 116 Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org> Architecture: amd64 Replaces: libgcc1 (<< 1:10) Provides: libgcc1 (= 1:10.2.1-6) Depends: gcc-10-base (= 10.2.1-6), libc6 (>= 2.14) Breaks: cryptsetup-initramfs (<< 2:2.2.2-3~) Description: GCC support library Description-md5: bbd60d723e97d8e06c04228ee4c76f10 Multi-Arch: same Homepage: http://gcc.gnu.org/ Important: yes Protected: yes Tag: role::shared-lib Section: libs Priority: optional Filename: pool/main/g/gcc-10/libgcc-s1_10.2.1-6_amd64.deb Size: 41400 MD5sum: 662ac9938f503745221bd777b5a94cab SHA256: e478f2709d8474165bb664de42e16950c391f30eaa55bc9b3573281d83a29daf Package: libcrypt1 Source: libxcrypt Version: 1:4.4.18-4 Installed-Size: 226 Maintainer: Marco d'Itri <md@linux.it> Architecture: amd64 Replaces: libc6 (<< 2.29-4) Depends: libc6 (>= 2.25) Description: libcrypt shared library Description-md5: deac8c9adc422e925bdaf6bffdd3e875 Multi-Arch: same Important: yes Protected: yes Tag: role::shared-lib Section: libs --More--(1%) [q]
Le statut de chaque paquet est inclus dans le fichier /var/lib/dpkg/status :
root@debian11:~# more /var/lib/dpkg/status
Package: acl
Status: install ok installed
Priority: optional
Section: utils
Installed-Size: 208
Maintainer: Guillem Jover <guillem@debian.org>
Architecture: amd64
Multi-Arch: foreign
Version: 2.2.53-10
Depends: libacl1 (= 2.2.53-10), libc6 (>= 2.14)
Description: access control list - utilities
This package contains the getfacl and setfacl utilities needed for
manipulating access control lists. It also contains the chacl IRIX
compatible utility.
Homepage: https://savannah.nongnu.org/projects/acl/
Package: adduser
Status: install ok installed
Priority: important
Section: admin
Installed-Size: 849
Maintainer: Debian Adduser Developers <adduser@packages.debian.org>
Architecture: all
Multi-Arch: foreign
Version: 3.118
Depends: passwd, debconf (>= 0.5) | debconf-2.0
Suggests: liblocale-gettext-perl, perl
Conffiles:
/etc/deluser.conf 773fb95e98a27947de4a95abb3d3f2a2
Description: add and remove users and groups
This package includes the 'adduser' and 'deluser' commands for creating
and removing users.
.
- 'adduser' creates new users and groups and adds existing users to
existing groups;
- 'deluser' removes users and groups and removes users from a given
group.
.
Adding users with 'adduser' is much easier than adding them manually.
Adduser will choose appropriate UID and GID values, create a home
directory, copy skeletal user configuration, and automate setting
initial values for the user's password, real name and so on.
.
Deluser can back up and remove users' home directories
and mail spool or all the files they own on the system.
.
A custom script can be executed after each of the commands.
Package: adwaita-icon-theme
Status: install ok installed
Priority: optional
Section: gnome
Installed-Size: 26370
Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
Architecture: all
Multi-Arch: foreign
Version: 3.38.0-1
Replaces: gnome-themes-standard-data (<< 3.18.0-2~)
--More--(0%)
[q]
Afin de connaître le nombre total de paquets installés, utilisez la commande suivante :
root@debian11:~# dpkg --get-selections | wc -l 1301
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@debian11:~# dpkg --get-selections | grep zip bzip2 install gzip install p7zip install p7zip-full install unzip install
Afin de connaître le statut de du paquet gzip, il convient de saisir la commande suivante :
root@debian11:~# dpkg -s gzip Package: gzip Essential: yes Status: install ok installed Priority: required Section: utils Installed-Size: 242 Maintainer: Milan Kupcevic <milan@debian.org> Architecture: amd64 Version: 1.10-4+deb11u1 Depends: dpkg (>= 1.15.4) | install-info Pre-Depends: libc6 (>= 2.17) 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'. Homepage: https://www.gnu.org/software/gzip/
Afin de lister tous les fichiers installés par le paquet gzip, utilisez la commande suivante :
root@debian11:~# dpkg -L gzip /. /bin /bin/gunzip /bin/gzexe /bin/gzip /bin/uncompress /bin/zcat /bin/zcmp /bin/zdiff /bin/zegrep /bin/zfgrep /bin/zforce /bin/zgrep /bin/zless /bin/zmore /bin/znew /usr /usr/share /usr/share/doc /usr/share/doc/gzip /usr/share/doc/gzip/NEWS.gz /usr/share/doc/gzip/README.gz /usr/share/doc/gzip/TODO /usr/share/doc/gzip/changelog.Debian.gz /usr/share/doc/gzip/changelog.gz /usr/share/doc/gzip/copyright /usr/share/info /usr/share/info/gzip.info.gz /usr/share/man /usr/share/man/man1 /usr/share/man/man1/gzexe.1.gz /usr/share/man/man1/gzip.1.gz /usr/share/man/man1/zdiff.1.gz /usr/share/man/man1/zforce.1.gz /usr/share/man/man1/zgrep.1.gz /usr/share/man/man1/zless.1.gz /usr/share/man/man1/zmore.1.gz /usr/share/man/man1/znew.1.gz /usr/share/man/man1/gunzip.1.gz /usr/share/man/man1/uncompress.1.gz /usr/share/man/man1/zcat.1.gz /usr/share/man/man1/zcmp.1.gz /usr/share/man/man1/zegrep.1.gz /usr/share/man/man1/zfgrep.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@debian11:~# dpkg -S /bin/zfgrep gzip: /bin/zfgrep
LAB #3 - Utilisation de 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@debian11:~# apt-get -y install dselect
Lancez maintenant dselect :
Debian 'dselect' package handling frontend version 1.20.9 (amd64). * 0. [A]ccess Choose the access method to use. 1. [U]pdate Update list of available packages, if possible. 2. [S]elect Request which packages you want on your system. 3. [I]nstall Install and upgrade wanted packages. 4. [C]onfig Configure any packages that are unconfigured. 5. [R]emove Remove unwanted software. 6. [Q]uit Quit dselect. Move around with ^P and ^N, cursor keys, initial letters, or digits; Press <enter> to confirm selection. ^L redraws screen. Copyright (C) 1994-1996 Ian Jackson. Copyright (C) 2000,2001 Wichert Akkerman. This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty.
A faire - Notez les instructions en bas de l'écran et expérimentez avec l'interface. Quand vous avez terminé, quittez avec la commande [q].
LAB #4 - Utilisation de 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@debian11:~# apt-get --help
apt 2.2.4 (amd64)
Usage: apt-get [options] command
apt-get [options] install|remove pkg1 [pkg2 ...]
apt-get [options] source pkg1 [pkg2 ...]
apt-get is a command line interface for retrieval of packages
and information about them from authenticated sources and
for installation, upgrade and removal of packages together
with their dependencies.
Most used commands:
update - Retrieve new lists of packages
upgrade - Perform an upgrade
install - Install new packages (pkg is libc6 not libc6.deb)
reinstall - Reinstall packages (pkg is libc6 not libc6.deb)
remove - Remove packages
purge - Remove packages and config files
autoremove - Remove automatically all unused packages
dist-upgrade - Distribution upgrade, see apt-get(8)
dselect-upgrade - Follow dselect selections
build-dep - Configure build-dependencies for source packages
satisfy - Satisfy dependency strings
clean - Erase downloaded archive files
autoclean - Erase old downloaded archive files
check - Verify that there are no broken dependencies
source - Download source archives
download - Download the binary package into the current directory
changelog - Download and display the changelog for the given package
See apt-get(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
This APT has Super Cow Powers.
4.1 - Configuration
APT peut être configuré par un fichier centralisé /etc/apt/apt.conf :
root@debian11:~# cat /etc/apt/apt.conf cat: /etc/apt/apt.conf: No such file or directory
Un exemple est fourni :
root@debian11:~# cat /usr/share/doc/apt/examples/apt.conf
/* 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";}
}
D'autres fichiers de configuration se trouvent dans le répertoire /etc/apt/apt.conf.d/ :
root@debian11:~# ls /etc/apt/apt.conf.d/ 00CDMountPoint 00trustcdrom 01autoremove 01autoremove-kernels 20listchanges 20packagekit 70debconf
Le contenu de ces fichiers sont :
root@debian11:~# cat /etc/apt/apt.conf.d/00CDMountPoint
Acquire::cdrom {
mount "/media/cdrom";
};
Dir::Media::MountPath "/media/cdrom";
root@debian11:~#
root@debian11:~# cat /etc/apt/apt.conf.d/00trustcdrom
APT::Authentication::TrustCDROM "true";
root@debian11:~#
root@debian11:~# cat /etc/apt/apt.conf.d/01autoremove
APT
{
NeverAutoRemove
{
"^firmware-linux.*";
"^linux-firmware$";
"^linux-image-[a-z0-9]*$";
"^linux-image-[a-z0-9]*-[a-z0-9]*$";
};
VersionedKernelPackages
{
# kernels
"linux-.*";
"kfreebsd-.*";
"gnumach-.*";
# (out-of-tree) modules
".*-modules";
".*-kernel";
};
Never-MarkAuto-Sections
{
"metapackages";
"contrib/metapackages";
"non-free/metapackages";
"restricted/metapackages";
"universe/metapackages";
"multiverse/metapackages";
};
Move-Autobit-Sections
{
"oldlibs";
"contrib/oldlibs";
"non-free/oldlibs";
"restricted/oldlibs";
"universe/oldlibs";
"multiverse/oldlibs";
};
};
root@debian11:~#
root@debian11:~# cat /etc/apt/apt.conf.d/01autoremove-kernels
// DO NOT EDIT! File autogenerated by /etc/kernel/postinst.d/apt-auto-removal
APT::LastInstalledKernel "5.10.0-13-amd64";
root@debian11:~#
root@debian11:~# cat /etc/apt/apt.conf.d/20listchanges
DPkg::Pre-Install-Pkgs { "/usr/bin/apt-listchanges --apt || test $? -lt 10"; };
DPkg::Tools::Options::/usr/bin/apt-listchanges::Version "2";
DPkg::Tools::Options::/usr/bin/apt-listchanges::InfoFD "20";
Dir::Etc::apt-listchanges-main "listchanges.conf";
Dir::Etc::apt-listchanges-parts "listchanges.conf.d";
root@debian11:~#
root@debian11:~# cat /etc/apt/apt.conf.d/20packagekit
// THIS FILE IS USED TO INFORM PACKAGEKIT
// THAT THE UPDATE-INFO MIGHT HAVE CHANGED
// Whenever dpkg is called we might have different updates
// i.e. if an user removes a package that had an update
DPkg::Post-Invoke {
"/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 4 --method org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null; /bin/echo > /dev/null";
};
// When Apt's cache is updated (i.e. apt-cache update)
APT::Update::Post-Invoke-Success {
"/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 4 --method org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null; /bin/echo > /dev/null";
};
root@debian11:~#
root@debian11:~# cat /etc/apt/apt.conf.d/70debconf
// Pre-configure all packages with debconf before they are installed.
// If you don't like it, comment it out.
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};
4.2 - Dépôts
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.
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@debian11:~# cat /etc/apt/sources.list # deb cdrom:[Debian GNU/Linux 11.3.0 _Bullseye_ - Official amd64 NETINST 20220326-11:22]/ bullseye main #deb cdrom:[Debian GNU/Linux 11.3.0 _Bullseye_ - Official amd64 NETINST 20220326-11:22]/ bullseye main deb http://deb.debian.org/debian/ bullseye main deb-src http://deb.debian.org/debian/ bullseye main deb http://security.debian.org/debian-security bullseye-security main deb-src http://security.debian.org/debian-security bullseye-security main # bullseye-updates, to get updates before a point release is made; # see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports deb http://deb.debian.org/debian/ bullseye-updates main deb-src http://deb.debian.org/debian/ bullseye-updates main # This system was installed using small removable media # (e.g. netinst, live or single CD). The matching "deb cdrom" # entries were disabled at the end of the installation process. # For information about how to configure apt package sources, # see the sources.list(5) manual.
Chaque ligne de ce fichier comporte 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
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.
La mise à jour de la base de références de la description des paquets est effectuée un utilisant la commande suivante :
root@debian11:~# apt-get update Hit:1 http://deb.debian.org/debian bullseye InRelease Get:2 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB] Hit:3 http://security.debian.org/debian-security bullseye-security InRelease Fetched 39.4 kB in 1s (58.1 kB/s) Reading package lists... Done
4.3 - 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. |
Commencez par installer le paquet mc :
root@debian11:~# apt-get install mc Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: mc-data Suggested packages: arj catdvi | texlive-binaries dbview djvulibre-bin epub-utils genisoimage gv imagemagick libaspell-dev links | w3m | lynx odt2txt python python-boto python-tz unar wimtools zip The following NEW packages will be installed: mc mc-data 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 1,880 kB of archives. After this operation, 7,772 kB of additional disk space will be used. Do you want to continue? [Y/n] y
La ré-installation d'un paquet est effectuée un utilisant la commande suivante :
root@debian11:~# apt-get --reinstall install mc Reading package lists... Done Building dependency tree... Done Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. Need to get 0 B/534 kB of archives. After this operation, 0 B of additional disk space will be used. (Reading database ... 102591 files and directories currently installed.) Preparing to unpack .../mc_3%3a4.8.26-1.1_amd64.deb ... Unpacking mc (3:4.8.26-1.1) over (3:4.8.26-1.1) ... Setting up mc (3:4.8.26-1.1) ... Processing triggers for desktop-file-utils (0.26-1) ... Processing triggers for mailcap (3.69) ...
La suppression complète d'un paquet, y compris les fichiers de configuration éventuellement modifiés est effectuée un utilisant la commande suivante :
root@debian11:~# apt-get --purge remove mc Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: mc-data Use 'apt autoremove' to remove it. The following packages will be REMOVED: mc* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 1,528 kB disk space will be freed. Do you want to continue? [Y/n] y
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@debian11:~# ls /var/cache/apt/archives/ binutils_2.35.2-2_amd64.deb libasan6_10.2.1-6_amd64.deb libcrypt-dev_1%3a4.4.18-4_amd64.deb libnsl-dev_1.3.0-2_amd64.deb manpages-dev_5.10-1_all.deb binutils-common_2.35.2-2_amd64.deb libbinutils_2.35.2-2_amd64.deb libctf0_2.35.2-2_amd64.deb libtirpc-dev_1.3.1-1_amd64.deb mc_3%3a4.8.26-1.1_amd64.deb binutils-x86-64-linux-gnu_2.35.2-2_amd64.deb libc6-dev_2.31-13+deb11u3_amd64.deb libctf-nobfd0_2.35.2-2_amd64.deb libtsan0_10.2.1-6_amd64.deb mc-data_3%3a4.8.26-1.1_all.deb dselect_1.20.9_amd64.deb libcc1-0_10.2.1-6_amd64.deb libgcc-10-dev_10.2.1-6_amd64.deb libubsan1_10.2.1-6_amd64.deb partial gcc-10_10.2.1-6_amd64.deb libc-dev-bin_2.31-13+deb11u3_amd64.deb libitm1_10.2.1-6_amd64.deb linux-libc-dev_5.10.106-1_amd64.deb gcc_4%3a10.2.1-1_amd64.deb libc-devtools_2.31-13+deb11u3_amd64.deb liblsan0_10.2.1-6_amd64.deb lock
Pour nettoyer le cache il convient d'utiliser la commande suivante :
root@debian11:~# apt-get clean root@debian11:~# 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 - permet de mettre à jour des paquets installés vers les versions les plus récentes. Cette action ne supprime aucun paquet installé.
- dist-upgrade - permet de mettre à jour des paquets installés vers les versions les plus récentes en mettant à jour aussi les dépendances modifiées. Cette action peut donc supprimer des paquets déjà installés. La commande est principalement utilisée pour mettre à 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.
A faire - Utilisez la commande man 8 apt-get pour vous renseigner sur les autres commandes et options.
D'autres commandes apt sont présentes sur le système :
root@debian11:~# ls -l /usr/bin/apt* -rwxr-xr-x 1 root root 18664 Jun 10 2021 /usr/bin/apt -rwxr-xr-x 1 root root 88376 Jun 10 2021 /usr/bin/apt-cache -rwxr-xr-x 1 root root 26936 Jun 10 2021 /usr/bin/apt-cdrom -rwxr-xr-x 1 root root 26856 Jun 10 2021 /usr/bin/apt-config -rwxr-xr-x 1 root root 22848 Jun 10 2021 /usr/bin/apt-extracttemplates -rwxr-xr-x 1 root root 276800 Jun 10 2021 /usr/bin/apt-ftparchive -rwxr-xr-x 1 root root 47416 Jun 10 2021 /usr/bin/apt-get -rwxr-xr-x 1 root root 28191 Jun 10 2021 /usr/bin/apt-key -rwxr-xr-x 1 root root 12242 Mar 28 2021 /usr/bin/apt-listchanges -rwxr-xr-x 1 root root 51512 Jun 10 2021 /usr/bin/apt-mark -rwxr-xr-x 1 root root 39152 Jun 10 2021 /usr/bin/apt-sortpkgs
Chaque commande a une fonction spécifique :
- apt-cache - utilisée pour se renseigner sur les paquets connus à APT,
- apt-cdrom - utilisée pour ajouter un CD-ROM aux sources des paquets disponibles,
- apt-config - utilisée pour obtenir les valeurs de la configuration de APT,
- apt-extracttemplates - utilisée pour extraire des fichiers templates pour la configuration d'un paquet lors de son installation. Le résultat est donc l'affichage de questions lors de l'installation d'un paquet dont les réponses sont nécessaires afin que l'installation s'effectue correctment,
- apt-ftparchive - utilisée pour créer les index dont APT se sert pour accéder aux sources des distributions,
- apt-key - utilisée pour gerer les clefs dont se sert APT pour authentifier les paquets. Les paquets authentifiés par ces clefs seront réputés fiables,
- apt-listchanges - utilisée pour afficher ce qui a changé dans la nouvelle version d'un paquet Debian par rapport à la version actuellement installée sur le système,
- apt-mark - utilisée pour diverses configurations d'un paquet, par exemple pour le marquer comme installé automatiquement ou manuellement, ou pour modifier les sélections de dpkg telles que hold install deinstall et purge,
- apt-sortpkgs - utilisée pour prendre un fichier index (source ou paquet) and trier les enregistrements de telle façon qu'ils soient ordonnés par nom.
LAB #5 - Utilisation de la Commande apt-cache
La commande apt-cache prend la forme suivante :
# apt-cache <options> <commande> <paquet(s)> [Entrée]
Les options et les commandes de la commande apt-cache sont :
root@debian11:~# apt-cache --help
apt 2.2.4 (amd64)
Usage: apt-cache [options] command
apt-cache [options] show pkg1 [pkg2 ...]
apt-cache queries and displays available information about installed
and installable packages. It works exclusively on the data acquired
into the local cache via the 'update' command of e.g. apt-get. The
displayed information may therefore be outdated if the last update was
too long ago, but in exchange apt-cache works independently of the
availability of the configured sources (e.g. offline).
Most used commands:
showsrc - Show source records
search - Search the package list for a regex pattern
depends - Show raw dependency information for a package
rdepends - Show reverse dependency information for a package
show - Show a readable record for the package
pkgnames - List the names of all packages in the system
policy - Show policy settings
See apt-cache(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
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. |
Utilisez la commande stats de la commande apt-cache pour obtenir des statistiques sur les paquets :
root@debian11:~# apt-cache stats Total package names: 98002 (2,744 k) Total package structures: 87215 (3,837 k) Normal packages: 58293 Pure virtual packages: 632 Single virtual packages: 18895 Mixed virtual packages: 347 Missing: 9048 Total distinct versions: 58947 (5,187 k) Total distinct descriptions: 117595 (2,822 k) Total dependencies: 352751/101877 (8,685 k) Total ver/file relations: 60904 (1,462 k) Total Desc/File relations: 52059 (1,249 k) Total Provides mappings: 22309 (535 k) Total globbed strings: 186821 (4,214 k) Total slack space: 100 k Total space accounted for: 32.4 M Total buckets in PkgHashTable: 196613 Unused: 126297 Used: 70316 Utilization: 35.7637% Average entries: 1.24033 Longest: 16 Shortest: 1 Total buckets in GrpHashTable: 196613 Unused: 119445 Used: 77168 Utilization: 39.2487% Average entries: 1.26998 Longest: 6 Shortest: 1
A faire - Utilisez le manuel d'apt-cache pour trouver les définitions des termes Normal packages, Pure virtual packages, Single virtual packages et Mixed virtual packages.
Recherchez maintenant la chaîne mc dans la liste des paquets :
root@debian11:~# apt-cache search mc | more libace-rmcast-6.5.12 - ACE reliable multicast library libace-rmcast-dev - ACE reliable multicast library - development files libace-tmcast-6.5.12 - ACE transactional multicast library libace-tmcast-dev - ACE transactional multicast library - development files alsa-oss - ALSA wrapper for OSS applications amule-emc - lists ed2k links inside emulecollection files apel - portable library for emacsen appstream - Software component metadata management gir1.2-appstreamcompose-1.0 - Building blocks to compose AppStream metadata (introspection data) ardour - the digital audio workstation libarmci-mpi-dev - ARMCI-MPI (Development version) auto-07p - software for continuation and bifurcation problems in ODE auto-multiple-choice - Auto Multiple Choice - multiple choice papers management auto-multiple-choice-common - Auto Multiple Choice - architecture independent files auto-multiple-choice-doc - Auto Multiple Choice - HTML documentation auto-multiple-choice-doc-pdf - Auto Multiple Choice - PDF documentation bali-phy - Bayesian Inference of Alignment and Phylogeny libbambamc-dev - Development files for reading and writing BAM (genome alignment) files libbambamc0 - Runtime library for reading and writing BAM (genome alignment) files python3-beaker - cache and session library for Python 3 beast-mcmc - Bayesian MCMC phylogenetic inference beast-mcmc-examples - Bayesian MCMC phylogenetic inference - example data libnucleotidelikelihoodcore0 - implementation of LikelihoodCore for nucleotides used by beast-mcmc beast2-mcmc - Bayesian MCMC phylogenetic inference beast2-mcmc-doc - Bayesian MCMC phylogenetic inference - documentation beast2-mcmc-examples - Bayesian MCMC phylogenetic inference - example data biobambam2 - tools for early stage alignment file processing libblosc-dev - high performance meta-compressor optimized for binary data (development files) libblosc1 - high performance meta-compressor optimized for binary data python3-cachy - Provide a simple yet effective caching library (Python 3) libcbf-dev - development files for CBFlib cbmc - bounded model checker for C and C++ programs cccc - C and C++ Code Counter, a software metrics tool libccid - PC/SC driver for USB CCID smart card readers libcglm-dev - Development files for the cglm library cif-tools - Suite of tools to manipulate, validate and query mmCIF files cl-babel - charset encoding/decoding library for Common Lisp cl-trivial-backtrace - generate a Common Lisp backtrace portably cl-uffi - Universal Foreign Function Library for Common Lisp claws-mail-spam-report - Spam reporting plugin for Claws Mail clonalframeml - Efficient Inference of Recombination in Whole Bacterial Genomes libclutter-imcontext-0.1-0 - Open GL based interactive canvas library IMContext framework libclutter-imcontext-0.1-0-dbg - Open GL based interactive canvas library IMContext framework (debug files) libclutter-imcontext-0.1-bin - Open GL based interactive canvas library IMContext framework libclutter-imcontext-0.1-dev - Open GL based interactive canvas library IMContext framework (dev. files) libclutter-imcontext-0.1-doc - Open GL based interactive canvas library IMContext framework (document) cmucl-source - CMUCL lisp sources cohomcalg - sheaf cohomology of line bundles on toric varieties cohomcalg-common - sheaf cohomology of line bundles on toric varieties (common files) collectd-core - statistics collection and monitoring daemon (core system) colortest - utilities to test color capabilities of terminal libcombblas-dev - an extensible parallel graph library for graph analytics libcombblas-docs - an extensible parallel graph library for graph analytics (docs) libcombblas1.16.0 - an extensible parallel graph library for graph analytics comgt - Option GlobeTrotter and Vodafone datacard control tool complexity - tool for analyzing the complexity of C program functions complexity-doc - tool for analyzing the complexity of C program (documentation) cp2k - Ab Initio Molecular Dynamics --More-- [q]
Pour être plus précis dans la recherche, il est nécessaire de rechercher une phrase clef :
root@debian11:~# apt-cache search "midnight commander" pilot - Simple file browser from Alpine, a text-based email client avfs - virtual filesystem to access archives, disk images, remote locations junior-system - Debian Jr. System tools krusader - twin-panel (commander-style) file manager mc - Midnight Commander - a powerful file manager mc-data - Midnight Commander - a powerful file manager -- data files moc - ncurses based console audio player
Afficher maintenant les informations concernant le paquet mc :
root@debian11:~# apt-cache show mc Package: mc Version: 3:4.8.26-1.1 Installed-Size: 1492 Maintainer: Dmitry Smirnov <onlyjob@debian.org> Architecture: amd64 Provides: mcedit Depends: libc6 (>= 2.15), libext2fs2 (>= 1.37), libglib2.0-0 (>= 2.59.2), libgpm2 (>= 1.20.7), libslang2 (>= 2.2.4), libssh2-1 (>= 1.2.8), mc-data (= 3:4.8.26-1.1) Recommends: mime-support, perl, unzip, sensible-utils Suggests: arj, bzip2, catdvi | texlive-binaries, dbview, djvulibre-bin, epub-utils, file, genisoimage, gv, imagemagick, libaspell-dev, links | w3m | lynx, odt2txt, poppler-utils, python, python-boto, python-tz, unar, wimtools, xpdf | pdf-viewer, zip Description-en: 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. Description-md5: 252a5c5aeeb7425db45357d4ab8aa55f Homepage: https://www.midnight-commander.org Tag: admin::filesystem, devel::lang:perl, devel::library, implemented-in::c, implemented-in::perl, interface::commandline, interface::text-mode, role::devel-lib, role::program, scope::application, suite::gnu, uitoolkit::ncurses, use::browsing, use::editing, use::organizing, works-with::archive, works-with::file Section: utils Priority: optional Filename: pool/main/m/mc/mc_4.8.26-1.1_amd64.deb Size: 534020 MD5sum: 0f8a73d3655353c27a214a483a7bc8ce SHA256: 517dbba5018b82bee2d6f2b940100360f54bc7cd83d0d791a372a1d279ceebad
Dernièrement, visualisez les dépendances du paquet mc :
root@debian11:~# apt-cache depends mc
mc
Depends: libc6
Depends: libext2fs2
Depends: libglib2.0-0
Depends: libgpm2
Depends: libslang2
Depends: libssh2-1
Depends: mc-data
Recommends: mime-support
Recommends: perl
Recommends: unzip
Recommends: sensible-utils
Suggests: arj
Suggests: bzip2
|Suggests: catdvi
Suggests: texlive-binaries
Suggests: dbview
Suggests: djvulibre-bin
Suggests: epub-utils
Suggests: file
Suggests: genisoimage
Suggests: gv
Suggests: imagemagick
graphicsmagick-imagemagick-compat
imagemagick-6.q16
Suggests: libaspell-dev
|Suggests: links
|Suggests: w3m
Suggests: lynx
Suggests: odt2txt
Suggests: poppler-utils
Suggests: <python>
python-is-python2
Suggests: <python-boto>
Suggests: <python-tz>
Suggests: unar
Suggests: wimtools
|Suggests: xpdf
Suggests: <pdf-viewer>
atril
evince
gv
mupdf
okular
qpdfview
viewpdf.app
xpdf
zathura-pdf-poppler
Suggests: zip
Les deux lignes suivantes :
|Suggests: xpdf Suggests: <pdf-viewer>
indiquent soit xpdf soit <pdf-viewer>
Important - Il est aussi possible d'utiliser la commande aptitude pour effectuer le gestion des paquets. Aptitude est un Front End à la commande apt-get.
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 |
Important : La bibliothèque la plus importante est libc. Sans elle, le système Linux ne peut pas fonctionner.
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@debian11:~# apt-get install mc Reading package lists... Done Building dependency tree... Done Reading state information... Done Suggested packages: arj catdvi | texlive-binaries dbview djvulibre-bin epub-utils genisoimage gv imagemagick libaspell-dev links | w3m | lynx odt2txt python python-boto python-tz unar wimtools zip The following NEW packages will be installed: mc 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 534 kB of archives. After this operation, 1,528 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian bullseye/main amd64 mc amd64 3:4.8.26-1.1 [534 kB] Fetched 534 kB in 0s (20.7 MB/s) Selecting previously unselected package mc. (Reading database ... 102490 files and directories currently installed.) Preparing to unpack .../mc_3%3a4.8.26-1.1_amd64.deb ... Unpacking mc (3:4.8.26-1.1) ... Setting up mc (3:4.8.26-1.1) ... update-alternatives: using /usr/bin/mcview to provide /usr/bin/view (view) in auto mode Processing triggers for desktop-file-utils (0.26-1) ... Processing triggers for mailcap (3.69) ...
La Commande ldd
Pour déterminer quelles sont les bibliothèques liées à une application, il convient d'utiliser la commande ldd :
root@debian11:~# ldd /usr/bin/mc
linux-vdso.so.1 (0x00007ffc4b5cf000)
libslang.so.2 => /lib/x86_64-linux-gnu/libslang.so.2 (0x00007ff729cb2000)
libgpm.so.2 => /lib/x86_64-linux-gnu/libgpm.so.2 (0x00007ff729caa000)
libe2p.so.2 => /lib/x86_64-linux-gnu/libe2p.so.2 (0x00007ff729c9e000)
libssh2.so.1 => /lib/x86_64-linux-gnu/libssh2.so.1 (0x00007ff729c69000)
libext2fs.so.2 => /lib/x86_64-linux-gnu/libext2fs.so.2 (0x00007ff729bfd000)
libgmodule-2.0.so.0 => /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007ff729bf7000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ff729ac6000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007ff729ac1000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff729a9f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff7298da000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff7298d4000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff729790000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007ff72966e000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff729651000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007ff72964b000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ff7295d8000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff72a0e1000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007ff7295b2000)
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@debian11:~# mv /usr/lib/x86_64-linux-gnu/libgpm.so.2 /usr/lib/x86_64-linux-gnu/libgpm.so.2.old
Exécutez de nouveau la commande ldd. Vous obtiendrez un résultat similaire à celui-ci :
root@debian11:~# ldd /usr/bin/mc
linux-vdso.so.1 (0x00007fff2999d000)
libslang.so.2 => /lib/x86_64-linux-gnu/libslang.so.2 (0x00007faa2f6d3000)
libgpm.so.2 => not found
libe2p.so.2 => /lib/x86_64-linux-gnu/libe2p.so.2 (0x00007faa2f6c7000)
libssh2.so.1 => /lib/x86_64-linux-gnu/libssh2.so.1 (0x00007faa2f692000)
libext2fs.so.2 => /lib/x86_64-linux-gnu/libext2fs.so.2 (0x00007faa2f626000)
libgmodule-2.0.so.0 => /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007faa2f620000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007faa2f4ef000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007faa2f4ea000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007faa2f4c8000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007faa2f303000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007faa2f2fd000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007faa2f1b9000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007faa2f097000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007faa2f07a000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007faa2f074000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007faa2f001000)
/lib64/ld-linux-x86-64.so.2 (0x00007faa2fb02000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007faa2efdb000)
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@debian11:~# 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@debian11:~# mv /usr/lib/x86_64-linux-gnu/libgpm.so.2.old /usr/lib/x86_64-linux-gnu/libgpm.so.2
root@debian11:~# ldd /usr/bin/mc
linux-vdso.so.1 (0x00007ffc23da7000)
libslang.so.2 => /lib/x86_64-linux-gnu/libslang.so.2 (0x00007fe759056000)
libgpm.so.2 => /lib/x86_64-linux-gnu/libgpm.so.2 (0x00007fe75904e000)
libe2p.so.2 => /lib/x86_64-linux-gnu/libe2p.so.2 (0x00007fe759042000)
libssh2.so.1 => /lib/x86_64-linux-gnu/libssh2.so.1 (0x00007fe75900d000)
libext2fs.so.2 => /lib/x86_64-linux-gnu/libext2fs.so.2 (0x00007fe758fa1000)
libgmodule-2.0.so.0 => /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007fe758f9b000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fe758e6a000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fe758e65000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe758e43000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe758c7e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe758c78000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe758b34000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fe758a12000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe7589f5000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007fe7589ef000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fe75897c000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe759485000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fe758956000)
Le fichier /etc/ld.so.conf
Le fichier /etc/ld.so.conf est utilisé pour configurer le cache /etc/ld.so.cache :
root@debian11:~# 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@debian11:~# ls -l /etc/ld.so.conf.d/ total 8 -rw-r--r-- 1 root root 44 Jul 29 2019 libc.conf -rw-r--r-- 1 root root 100 Mar 17 22:37 x86_64-linux-gnu.conf
Le contenu de ces deux fichiers est le suivant :
root@debian11:~# cat /etc/ld.so.conf.d/libc.conf # libc default configuration /usr/local/lib
root@debian11:~# cat /etc/ld.so.conf.d/x86_64-linux-gnu.conf # Multiarch support /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
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@debian11:~# ldconfig -p | more
851 libs found in cache `/etc/ld.so.cache'
libz3.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libz3.so.4
libzvbi.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libzvbi.so.0
libzvbi-chains.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libzvbi-chains.so.0
libzstd.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libzstd.so.1
libzmq.so.5 (libc6,x86-64) => /lib/x86_64-linux-gnu/libzmq.so.5
libzmf-0.0.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libzmf-0.0.so.0
libzbar.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libzbar.so.0
libz.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libz.so.1
libyaml-0.so.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libyaml-0.so.2
libyajl.so.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libyajl.so.2
libx265.so.192 (libc6,x86-64) => /lib/x86_64-linux-gnu/libx265.so.192
libx264.so.160 (libc6,x86-64) => /lib/x86_64-linux-gnu/libx264.so.160
libxxhash.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxxhash.so.0
libxvidcore.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxvidcore.so.4
libxtables.so.12 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxtables.so.12
libxslt.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxslt.so.1
libxshmfence.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxshmfence.so.1
libxml2.so.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxml2.so.2
libxmlsec1.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxmlsec1.so.1
libxmlsec1-nss.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxmlsec1-nss.so.1
libxklavier.so.16 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxklavier.so.16
libxkbregistry.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxkbregistry.so.0
libxkbfile.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxkbfile.so.1
libxkbcommon.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxkbcommon.so.0
libxfconf-0.so.3 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxfconf-0.so.3
libxfce4util.so.7 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxfce4util.so.7
libxfce4ui-2.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxfce4ui-2.so.0
libxfce4panel-2.0.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxfce4panel-2.0.so.4
libxfce4kbd-private-3.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxfce4kbd-private-3.so.0
libxcb.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb.so.1
libxcb-xfixes.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-xfixes.so.0
libxcb-util.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-util.so.1
libxcb-sync.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-sync.so.1
libxcb-shm.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-shm.so.0
libxcb-shape.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-shape.so.0
libxcb-render.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-render.so.0
libxcb-randr.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-randr.so.0
libxcb-present.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-present.so.0
libxcb-glx.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-glx.so.0
libxcb-dri3.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-dri3.so.0
libxcb-dri2.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxcb-dri2.so.0
libxatracker.so.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxatracker.so.2
libxapian.so.30 (libc6,x86-64) => /lib/x86_64-linux-gnu/libxapian.so.30
libwrap.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwrap.so.0
libwps-0.4.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwps-0.4.so.4
libwpg-0.3.so.3 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwpg-0.3.so.3
libwpe-1.0.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwpe-1.0.so.1
libwpd-0.10.so.10 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwpd-0.10.so.10
libwoff2enc.so.1.0.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwoff2enc.so.1.0.2
libwoff2dec.so.1.0.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwoff2dec.so.1.0.2
libwoff2common.so.1.0.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwoff2common.so.1.0.2
libwnck-3.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwnck-3.so.0
libwebrtc_audio_processing.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwebrtc_audio_processing.so.1
libwebpmux.so.3 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwebpmux.so.3
libwebpdemux.so.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwebpdemux.so.2
libwebp.so.6 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwebp.so.6
libwebkit2gtk-4.0.so.37 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37
--More--
[q]
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.
<html>
Copyright © 2022 Hugh Norris.
</html>