Ceci est une ancienne révision du document !
Table des matières
Version : 2024.01
Dernière mise-à-jour : 2024/09/25 08:09
RH12407 - Gestion des Paquets
Contenu du Module
- RH12407 - 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 - La commande rpm
- 2.1 - Configuration
- 2.2 - Utilisation
- LAB #3 - La commande dnf
- 3.1 - Présentation
- 3.2 - Configuration
- 3.3 - Dépôts
- 3.4 - Rechercher des Paquets
- 3.5 - Obtenir de l'Information sur un Paquet et le Télécharger
- 3.6 - Installer un Paquet
- 3.7 - Mettre à jour des Paquets
- 3.8 - Supprimer des Paquets
- LAB #4 - Les Bibliothèques Partagées
- 4.1 - Présentation
- Introduction
- Stockage
- ld-linux.so.2
- 4.2 - La Commande ldd
- 4.3 - Le fichier /etc/ld.so.conf
- 4.4 - La Commande ldconfig
LAB #1 - 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@centos8 ~]# wget https://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz --2021-04-20 16:56:18-- 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 941KB/s in 0.4s 2021-04-20 16:56:19 (941 KB/s) - ‘hello-2.1.1.tar.gz’ saved [389363/389363]
Ensuite désarchivez le logiciel :
[root@centos8 ~]# 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@centos8 ~]# cd hello-2.1.1/
A l'étude du fichier README, celui-ci nous renvoie vers le fichier INSTALL. Visualisez donc ce dernier :
[root@centos8 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.) --Plus--(11%)
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@centos8 hello-2.1.1]# ./configure checking for a BSD-compatible install... /bin/install -c checking whether build environment is sane... yes checking for gawk... gawk 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... /bin/msgfmt checking for gmsgfmt... /bin/msgfmt checking for xgettext... /bin/xgettext checking for msgmerge... /bin/msgmerge 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... /bin/ld checking if the linker (/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.
[root@centos8 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=gcc3 /bin/sh ../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/sh ../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/sh ../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/sh ../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@centos8 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@centos8 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/sh ../mkinstalldirs /usr/local/info mkdir -p -- /usr/local/info /bin/install -c -m 644 ./hello.info /usr/local/info/hello.info install-info --info-dir=/usr/local/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; \ /bin/install -c -m 644 libintl.h /usr/local/include/libintl.h; \ @LIBTOOL@ --mode=install \ /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; \ /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; \ /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; \ /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; \ /bin/install -c -m 644 VERSION /usr/local/share/gettext/intl/VERSION; \ /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 \ /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; \ /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 \ /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/sh ../mkinstalldirs /usr/local/bin /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/sh ../mkinstalldirs /usr/local/man/man1 mkdir -p -- /usr/local/man/man1 /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@centos8 hello-2.1.1]# hello Hello, world!
Le logiciel hello a été correctement installé.
LAB #2 - La commande rpm
Afin de faciliter l'installation, la désinstallation et la gestion des logiciels (appelés paquets), CentOS et Red Hat utilisent un format de fichier de logiciels installables spécifique. Celui-ci s'appelle RPM pour Red Hat Package Manager. La commande utilisée pour manipuler ses paquets s'appelle aussi rpm.
Les options de la commande rpm sont :
[root@centos8 hello-2.1.1]# cd ~ [root@centos8 ~]# rpm --help Usage: rpm [OPTION...] Query/Verify package selection options: -a, --all query/verify all packages -f, --file query/verify package(s) owning file -g, --group query/verify package(s) in group -p, --package query/verify a package file --pkgid query/verify package(s) with package identifier --hdrid query/verify package(s) with header identifier --triggeredby query the package(s) triggered by the package --whatconflicts query/verify the package(s) which require a dependency --whatrequires query/verify the package(s) which require a dependency --whatobsoletes query/verify the package(s) which obsolete a dependency --whatprovides query/verify the package(s) which provide a dependency --whatrecommends query/verify the package(s) which recommends a dependency --whatsuggests query/verify the package(s) which suggests a dependency --whatsupplements query/verify the package(s) which supplements a dependency --whatenhances query/verify the package(s) which enhances a dependency --nomanifest do not process non-package files as manifests Query options (with -q or --query): -c, --configfiles list all configuration files -d, --docfiles list all documentation files -L, --licensefiles list all license files -A, --artifactfiles list all artifact files --dump dump basic file information -l, --list list files in package --queryformat=QUERYFORMAT use the following query format -s, --state display the states of the listed files Verify options (with -V or --verify): --nofiledigest don't verify digest of files --nofiles don't verify files in package --nodeps don't verify package dependencies --noscript don't execute verify script(s) Install/Upgrade/Erase options: --allfiles install all files, even configurations which might otherwise be skipped --allmatches remove all packages which match <package> (normally an error is generated if <package> specified multiple packages) --badreloc relocate files in non-relocatable package -e, --erase=<package>+ erase (uninstall) package --excludedocs do not install documentation --excludepath=<path> skip files with leading component <path> --force short hand for --replacepkgs --replacefiles -F, --freshen=<packagefile>+ upgrade package(s) if already installed -h, --hash print hash marks as package installs (good with -v) --ignorearch don't verify package architecture --ignoreos don't verify package operating system --ignoresize don't check disk space before installing --noverify short hand for --ignorepayload --ignoresignature -i, --install install package(s) --justdb update the database, but do not modify the filesystem --nodeps do not verify package dependencies --nofiledigest don't verify digest of files --nocontexts don't install file security contexts --nocaps don't install file capabilities --noorder do not reorder package installation to satisfy dependencies --noscripts do not execute package scriptlet(s) --notriggers do not execute any scriptlet(s) triggered by this package --oldpackage upgrade to an old version of the package (--force on upgrades does this automatically) --percent print percentages as package installs --prefix=<dir> relocate the package to <dir>, if relocatable --relocate=<old>=<new> relocate files from path <old> to <new> --replacefiles ignore file conflicts between packages --replacepkgs reinstall if the package is already present --test don't install, but tell if it would work or not -U, --upgrade=<packagefile>+ upgrade package(s) --reinstall=<packagefile>+ reinstall package(s) Common options for all rpm modes and executables: -D, --define='MACRO EXPR' define MACRO with value EXPR --undefine=MACRO undefine MACRO -E, --eval='EXPR' print macro expansion of EXPR --target=CPU-VENDOR-OS Specify target platform --macros=<FILE:...> read <FILE:...> instead of default file(s) --noplugins don't enable any plugins --nodigest don't verify package digest(s) --nosignature don't verify package signature(s) --rcfile=<FILE:...> read <FILE:...> instead of default file(s) -r, --root=ROOT use ROOT as top level directory (default: "/") --dbpath=DIRECTORY use database in DIRECTORY --querytags display known query tags --showrc display final rpmrc and macro configuration --quiet provide less detailed output -v, --verbose provide more detailed output --version print the version of rpm being used Options implemented via popt alias/exec: --scripts list install/erase scriptlets from package(s) --setperms set permissions of files in a package --setugids set user/group ownership of files in a package --setcaps set capabilities of files in a package --restore restore file/directory permissions --conflicts list capabilities this package conflicts with --obsoletes list other packages removed by installing this package --provides list capabilities that this package provides --requires list capabilities required by package(s) --recommends list capabilities recommended by package(s) --suggests list capabilities suggested by package(s) --supplements list capabilities supplemented by package(s) --enhances list capabilities enhanced by package(s) --info list descriptive information from package(s) --changelog list change logs for this package --changes list changes for this package with full time stamps --xml list metadata in xml --triggers list trigger scriptlets from package(s) --filetriggers list filetrigger scriptlets from package(s) --last list package(s) by install time, most recent first --dupes list duplicated packages --filesbypkg list all files from each package --fileclass list file names with their classes --filecolor list file names with their colors --fileprovide list file names with their provides --filerequire list file names with requires --filecaps list file names with their POSIX1.e capabilities Help options: -?, --help Show this help message --usage Display brief usage message
2.1 - Configuration
Le fichier de configuration principal de la commande rpm est /usr/lib/rpm/rpmrc :
[root@centos8 ~]# more /usr/lib/rpm/rpmrc #/*! \page config_rpmrc Default configuration: /usr/lib/rpm/rpmrc # \verbatim # # This is a global RPM configuration file. All changes made here will # be lost when the rpm package is upgraded. Any per-system configuration # should be added to /etc/rpmrc, while per-user configuration should # be added to ~/.rpmrc. # ############################################################# # Values for RPM_OPT_FLAGS for various platforms # "fat" binary with both archs, for Darwin optflags: fat -O2 -g -arch i386 -arch ppc optflags: i386 -O2 -g -march=i386 -mtune=i686 optflags: i486 -O2 -g -march=i486 optflags: i586 -O2 -g -march=i586 optflags: i686 -O2 -g -march=i686 optflags: pentium3 -O2 -g -march=pentium3 optflags: pentium4 -O2 -g -march=pentium4 optflags: athlon -O2 -g -march=athlon optflags: geode -Os -g -m32 -march=geode optflags: ia64 -O2 -g optflags: x86_64 -O2 -g optflags: amd64 -O2 -g optflags: ia32e -O2 -g optflags: alpha -O2 -g -mieee optflags: alphaev5 -O2 -g -mieee -mtune=ev5 optflags: alphaev56 -O2 -g -mieee -mtune=ev56 optflags: alphapca56 -O2 -g -mieee -mtune=pca56 optflags: alphaev6 -O2 -g -mieee -mtune=ev6 optflags: alphaev67 -O2 -g -mieee -mtune=ev67 optflags: sparc -O2 -g -m32 -mtune=ultrasparc optflags: sparcv8 -O2 -g -m32 -mtune=ultrasparc -mv8 optflags: sparcv9 -O2 -g -m32 -mtune=ultrasparc optflags: sparcv9v -O2 -g -m32 -mtune=niagara optflags: sparc64 -O2 -g -m64 -mtune=ultrasparc optflags: sparc64v -O2 -g -m64 -mtune=niagara optflags: m68k -O2 -g -fomit-frame-pointer optflags: ppc -O2 -g optflags: ppc8260 -O2 -g optflags: ppc8560 -O2 -g optflags: ppc32dy4 -O2 -g optflags: ppciseries -O2 -g optflags: ppcpseries -O2 -g optflags: ppc64 -O2 -g optflags: ppc64le -O2 -g optflags: ppc64p7 -O3 -mtune=power7 -mcpu=power7 -g optflags: parisc -O2 -g -mpa-risc-1-0 optflags: hppa1.0 -O2 -g -mpa-risc-1-0 optflags: hppa1.1 -O2 -g -mpa-risc-1-0 optflags: hppa1.2 -O2 -g -mpa-risc-1-0 --More--(11%)
Ces directives indiquent comment optimiser la construction d'un rpm en fonction du type de processeur retourné par la commande uname -p. Par exemple, la directive buildarchtranslate: athlon: i386 indique que le processus doit utiliser les optimisations i386 lors de la construction d'un src.rpm sur une architecture athlon. Si au contraire il est souhaité que les optimisations athlon soient utilisées, il convient d'inclure la ligne buildarchtranslate: athlon: athlon dans le fichier /etc/rpmrc. En effet lors de la mise à jour du paquet rpm, le fichier /usr/lib/rpm/rpmrc est écrasé. Toute modification des directives de ce fichier doivent être inscrites dans /etc/rpmrc ou dans un fichier ~/.rpmrc spécifique à un utilisateur.
2.2 - Utilisation
Afin de connaître la liste des paquets installés sur la machine, il convient de saisir la commande suivante dans une console en tant que root :
[root@centos8 ~]# rpm -qa | more dracut-squash-049-95.git20200804.el8_3.4.x86_64 gnutls-dane-3.6.14-8.el8_3.x86_64 mtr-0.92-3.el8.x86_64 fontpackages-filesystem-1.44-22.el8.noarch dhcp-libs-4.3.6-41.el8.x86_64 alsa-lib-1.2.3.2-1.el8.x86_64 geolite2-city-20180605-1.el8.noarch cockpit-ws-224.2-1.el8.x86_64 python3-dbus-1.2.4-15.el8.x86_64 libvirt-daemon-config-network-6.0.0-28.1.module_el8.3.0+755+88436ea4.x86_64 samba-client-libs-4.12.3-12.el8.3.x86_64 libICE-1.0.9-15.el8.x86_64 bind-license-9.11.20-5.el8_3.1.noarch dnf-4.2.23-4.el8.noarch at-spi2-core-2.28.0-1.el8.x86_64 libssh-config-0.9.4-2.el8.noarch bzip2-libs-1.0.6-26.el8.x86_64 python3-syspurpose-1.27.16-1.el8.x86_64 perl-Unicode-Normalize-1.25-396.el8.x86_64 centos-linux-release-8.3-1.2011.el8.noarch sssd-krb5-2.3.0-9.el8.x86_64 perl-MIME-Base64-3.15-396.el8.x86_64 glibc-langpack-en-2.28-127.el8.x86_64 libcollection-0.7.0-39.el8.x86_64 vim-filesystem-8.0.1763-15.el8.noarch perl-Sys-Virt-6.0.0-1.module_el8.3.0+555+a55c8938.x86_64 elfutils-libelf-0.180-1.el8.x86_64 vim-enhanced-8.0.1763-15.el8.x86_64 kernel-modules-4.18.0-147.8.1.el8_1.x86_64 perl-Encode-2.97-3.el8.x86_64 audit-libs-3.0-0.17.20191104git1c2f876.el8.x86_64 grub2-pc-2.02-90.el8_3.1.x86_64 perl-libnet-3.11-3.el8.noarch --More--
Afin de connaître le nombre total de paquets installés sur la machine, utilisez la commande suivante :
[root@centos8 ~]# rpm -qa | wc -l 802
Imaginons maintenant que vous souhaitez vérifier si un paquet contenant la chaine de caractères setup soit déjà installé sur la machine. Dans ce cas, il convient d'utiliser une commande telle la suivante :
[root@centos8 ~]# rpm -qa | grep setup platform-python-setuptools-39.2.0-6.el8.noarch python3-setuptools-wheel-39.2.0-6.el8.noarch setup-2.12.2-6.el8.noarch cryptsetup-libs-2.3.3-2.el8.x86_64 cryptsetup-2.3.3-2.el8.x86_64
Afin de connaître les détails du paquet setup-2.8.71-4.el7.noarch, il convient de saisir la commande suivante :
[root@centos8 ~]# rpm -qi setup Name : setup Version : 2.12.2 Release : 6.el8 Architecture: noarch Install Date: Mon 19 Apr 2021 11:50:02 AM EDT Group : System Environment/Base Size : 724837 License : Public Domain Signature : RSA/SHA256, Fri 15 May 2020 01:23:16 AM EDT, Key ID 05b555b38483c65d Source RPM : setup-2.12.2-6.el8.src.rpm Build Date : Fri 15 May 2020 01:20:15 AM EDT Build Host : aarch64-02.mbox.centos.org Relocations : (not relocatable) Packager : CentOS Buildsys <bugs@centos.org> Vendor : CentOS URL : https://pagure.io/setup/ Summary : A set of system configuration and setup files Description : The setup package contains a set of important system configuration and setup files, such as passwd, group, and profile.
Afin de lister tous les fichiers installés par le paquet concerné, utilisez la commande suivante :
[root@centos8 ~]# rpm -ql setup /etc/aliases /etc/bashrc /etc/csh.cshrc /etc/csh.login /etc/dnf/protected.d/setup.conf /etc/environment /etc/ethertypes /etc/exports /etc/filesystems /etc/fstab /etc/group /etc/gshadow /etc/host.conf /etc/hosts /etc/inputrc /etc/motd /etc/networks /etc/passwd /etc/printcap /etc/profile /etc/profile.d /etc/profile.d/csh.local /etc/profile.d/lang.csh /etc/profile.d/lang.sh /etc/profile.d/sh.local /etc/protocols /etc/services /etc/shadow /etc/shells /etc/subgid /etc/subuid /usr/share/doc/setup /usr/share/doc/setup/uidgid /usr/share/licenses/setup /usr/share/licenses/setup/COPYING /var/log/lastlog
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@centos8 ~]# rpm -qf /etc/exports setup-2.12.2-6.el8.noarch
Pour connaître les fichiers modifiés depuis l'installation d'un paquet, utilisez la commande suivante :
[root@centos8 ~]# rpm -qV setup .M....G.. g /var/log/lastlog
Dans le cas où aucun fichier n'a été modifié, la console n'affiche rien. Dans le cas où les fichiers ont été modifiés, le système vous indique, fichier par fichier, les modifications apportées selon le tableau ci-dessous. Pour plus d'informations utilisez les commandes man et info :
Lettre ou mot Clé | Description |
---|---|
5 | Contrôle MD5 |
S | Taille du fichier |
L | Lien symbolique |
T | Date de modification |
D | Périphérique |
U | Utilisateur propriétaire |
G | Groupe propriétaire |
M | Droits d'accès |
? | Fichier illisible |
Manquant | Fichier manquant |
Important : Un paquet rpm est un fichier cpio modifié. Pour pouvoir extraire le contenu d'un src.rpm et explorer l'arborescence utilisé pour construire le paquet, utilisez la commande rpm2cpio paquet.src.rpm | cpio -i –make-directories
LAB #3 - La commande dnf
3.1 - Présentation
dnf est une abréviation de Dandified YUM. Historiquement, RHEL et CentOS ont utilisé Yellow dog Updater, Modified (Yum) en tant qu'utilitaire de gestion de paquets. Sous RHEL/CentOS 8, la commande yum a été remplacée par la commande dnf-3 :
[root@centos8 ~]# ls -l /usr/bin/dnf-3 -rwxr-xr-x. 1 root root 1954 Aug 4 2020 /usr/bin/dnf-3 [root@centos8 ~]# ls -l /usr/bin/yum lrwxrwxrwx. 1 root root 5 Aug 4 2020 /usr/bin/yum -> dnf-3 [root@centos8 ~]# ls -l /usr/bin/dnf lrwxrwxrwx. 1 root root 5 Aug 4 2020 /usr/bin/dnf -> dnf-3
La commande dnf apporte des améliorations suivantes par rapport à la commande yum :
- une résolution des dépendances plus rapide en utilisant moins de mémoire,
- le fonctionnement dans les environnements Python 2 et Python 3.
Il est à noter que :
- l'utilisation de la commande dnf est similaire à l'utilisation de la commande yum,
- les commandes dnf et yum peuvent coexister sur le même système.
L'utilisation de l'alias dnf de la commande dnf-3 prend la forme suivante :
# dnf <options> <commande> <paquet(s)> [Entrée]
Les options et commandes de dnf sont :
[root@centos8 ~]# dnf --help usage: dnf [options] COMMAND List of Main Commands: alias List or create command aliases autoremove remove all unneeded packages that were originally installed as dependencies check check for problems in the packagedb check-update check for available package upgrades clean remove cached data deplist List package's dependencies and what packages provide them distro-sync synchronize installed packages to the latest available versions downgrade Downgrade a package group display, or use, the groups information help display a helpful usage message history display, or use, the transaction history info display details about a package or group of packages install install a package or packages on your system list list a package or groups of packages makecache generate the metadata cache mark mark or unmark installed packages as installed by user. module Interact with Modules. provides find what package provides the given value reinstall reinstall a package remove remove a package or packages from your system repolist display the configured software repositories repoquery search for packages matching keyword repository-packages run commands on top of all packages in given repository search search package details for the given string shell run an interactive DNF shell swap run an interactive DNF mod for remove and install one spec updateinfo display advisories about packages upgrade upgrade a package or packages on your system upgrade-minimal upgrade, but only 'newest' package match which fixes a problem that affects your system List of Plugin Commands: builddep Install build dependencies for package or spec file changelog Show changelog data of packages config-manager manage dnf configuration options and repositories copr Interact with Copr repositories. debug-dump dump information about installed rpm packages to file debug-restore restore packages recorded in debug-dump file debuginfo-install install debuginfo packages download Download package to current directory needs-restarting determine updated binaries that need restarting playground Interact with Playground repository. repoclosure Display a list of unresolved dependencies for repositories repodiff List differences between two sets of repositories repograph Output a full package dependency graph in dot format repomanage Manage a directory of rpm packages reposync download all packages from remote repo General DNF options: -c [config file], --config [config file] config file location -q, --quiet quiet operation -v, --verbose verbose operation --version show DNF version and exit --installroot [path] set install root --nodocs do not install documentations --noplugins disable all plugins --enableplugin [plugin] enable plugins by name --disableplugin [plugin] disable plugins by name --releasever RELEASEVER override the value of $releasever in config and repo files --setopt SETOPTS set arbitrary config and repo options --skip-broken resolve depsolve problems by skipping packages -h, --help, --help-cmd show command help --allowerasing allow erasing of installed packages to resolve dependencies -b, --best try the best available package versions in transactions. --nobest do not limit the transaction to the best candidate -C, --cacheonly run entirely from system cache, don't update cache -R [minutes], --randomwait [minutes] maximum command wait time -d [debug level], --debuglevel [debug level] debugging output level --debugsolver dumps detailed solving results into files --showduplicates show duplicates, in repos, in list/search commands -e ERRORLEVEL, --errorlevel ERRORLEVEL error output level --obsoletes enables dnf's obsoletes processing logic for upgrade or display capabilities that the package obsoletes for info, list and repoquery --rpmverbosity [debug level name] debugging output level for rpm -y, --assumeyes automatically answer yes for all questions --assumeno automatically answer no for all questions --enablerepo [repo] Enable additional repositories. List option. Supports globs, can be specified multiple times. --disablerepo [repo] Disable repositories. List option. Supports globs, can be specified multiple times. --repo [repo], --repoid [repo] enable just specific repositories by an id or a glob, can be specified multiple times --enable enable repos with config-manager command (automatically saves) --disable disable repos with config-manager command (automatically saves) -x [package], --exclude [package], --excludepkgs [package] exclude packages by name or glob --disableexcludes [repo], --disableexcludepkgs [repo] disable excludepkgs --repofrompath [repo,path] label and path to an additional repository to use (same path as in a baseurl), can be specified multiple times. --noautoremove disable removal of dependencies that are no longer used --nogpgcheck disable gpg signature checking (if RPM policy allows) --color COLOR control whether color is used --refresh set metadata as expired before running the command -4 resolve to IPv4 addresses only -6 resolve to IPv6 addresses only --destdir DESTDIR, --downloaddir DESTDIR set directory to copy packages to --downloadonly only download packages --comment COMMENT add a comment to transaction --bugfix Include bugfix relevant packages, in updates --enhancement Include enhancement relevant packages, in updates --newpackage Include newpackage relevant packages, in updates --security Include security relevant packages, in updates --advisory ADVISORY, --advisories ADVISORY Include packages needed to fix the given advisory, in updates --bz BUGZILLA, --bzs BUGZILLA Include packages needed to fix the given BZ, in updates --cve CVES, --cves CVES Include packages needed to fix the given CVE, in updates --sec-severity {Critical,Important,Moderate,Low}, --secseverity {Critical,Important,Moderate,Low} Include security relevant packages matching the severity, in updates --forcearch ARCH Force the use of an architecture
Avant de poursuivre, exécutez les deux commandes suivantes pour réparer les dépôts cassés :
[root@centos8 ~]# sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* [root@centos8 ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
3.2 - Configuration
La configuration principale de dnf est effectuée en éditant le fichier /etc/dnf/dnf.conf :
[root@centos8 ~]# cat /etc/dnf/dnf.conf [main] gpgcheck=1 installonly_limit=3 clean_requirements_on_remove=True best=True skip_if_unavailable=False
Le répertoire /etc/dnf contient lui-même des répertoires :
[root@centos8 ~]# ls -l /etc/dnf total 4 drwxr-xr-x. 2 root root 6 Aug 4 2020 aliases.d -rw-r--r--. 1 root root 108 Jun 2 2020 dnf.conf drwxr-xr-x. 2 root root 168 Apr 19 12:13 modules.d drwxr-xr-x. 2 root root 6 Aug 4 2020 modules.defaults.d drwxr-xr-x. 3 root root 89 Aug 4 2020 plugins drwxr-xr-x. 2 root root 93 Apr 19 11:52 protected.d drwxr-xr-x. 2 root root 37 Aug 4 2020 vars
3.3 - 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 dans un fichier par dépôt stocké dans le répertoire /etc/yum.repos.d :
[root@centos8 ~]# ls /etc/yum.repos.d/ CentOS-Linux-AppStream.repo CentOS-Linux-Plus.repo CentOS-Linux-BaseOS.repo CentOS-Linux-PowerTools.repo CentOS-Linux-ContinuousRelease.repo CentOS-Linux-Sources.repo CentOS-Linux-Debuginfo.repo epel-modular.repo CentOS-Linux-Devel.repo epel-playground.repo CentOS-Linux-Extras.repo epel.repo CentOS-Linux-FastTrack.repo epel-testing-modular.repo CentOS-Linux-HighAvailability.repo epel-testing.repo CentOS-Linux-Media.repo
Par exemple :
[root@centos8 ~]# cat /etc/yum.repos.d/CentOS-Linux-BaseOS.repo # CentOS-Linux-BaseOS.repo # # The mirrorlist system uses the connecting IP address of the client and the # update status of each mirror to pick current mirrors that are geographically # close to the client. You should use this for CentOS updates unless you are # manually picking other mirrors. # # If the mirrorlist does not work for you, you can try the commented out # baseurl line instead. [baseos] name=CentOS Linux $releasever - BaseOS mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Pour consulter tous les dépôts, activés ou non, en utilisant dnf, il convient d'utiliser la commande repolist all :
[root@centos8 ~]# dnf repolist all repo id repo name status appstream CentOS Linux 8 - AppStream enabled appstream-source CentOS Linux 8 - AppStream - Source disabled baseos CentOS Linux 8 - BaseOS enabled baseos-source CentOS Linux 8 - BaseOS - Source disabled cr CentOS Linux 8 - ContinuousRelease disabled debuginfo CentOS Linux 8 - Debuginfo disabled devel CentOS Linux 8 - Devel WARNING! FOR BUILDROOT USE ONLY! disabled epel Extra Packages for Enterprise Linux 8 - x86_64 enabled epel-debuginfo Extra Packages for Enterprise Linux 8 - x86_64 - Debug disabled epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64 enabled epel-modular-debuginfo Extra Packages for Enterprise Linux Modular 8 - x86_64 - Debug disabled epel-modular-source Extra Packages for Enterprise Linux Modular 8 - x86_64 - Source disabled epel-playground Extra Packages for Enterprise Linux 8 - Playground - x86_64 disabled epel-playground-debuginfo Extra Packages for Enterprise Linux 8 - Playground - x86_64 - Debug disabled epel-playground-source Extra Packages for Enterprise Linux 8 - Playground - x86_64 - Source disabled epel-source Extra Packages for Enterprise Linux 8 - x86_64 - Source disabled epel-testing Extra Packages for Enterprise Linux 8 - Testing - x86_64 disabled epel-testing-debuginfo Extra Packages for Enterprise Linux 8 - Testing - x86_64 - Debug disabled epel-testing-modular Extra Packages for Enterprise Linux Modular 8 - Testing - x86_64 disabled epel-testing-modular-debuginfo Extra Packages for Enterprise Linux Modular 8 - Testing - x86_64 - De disabled epel-testing-modular-source Extra Packages for Enterprise Linux Modular 8 - Testing - x86_64 - So disabled epel-testing-source Extra Packages for Enterprise Linux 8 - Testing - x86_64 - Source disabled extras CentOS Linux 8 - Extras enabled extras-source CentOS Linux 8 - Extras - Source disabled fasttrack CentOS Linux 8 - FastTrack disabled ha CentOS Linux 8 - HighAvailability disabled media-appstream CentOS Linux 8 - Media - AppStream disabled media-baseos CentOS Linux 8 - Media - BaseOS disabled plus CentOS Linux 8 - Plus disabled plus-source CentOS Linux 8 - Plus - Source disabled powertools CentOS Linux 8 - PowerTools
Pour ne consulter que la liste des dépôts actifs, utilisez la commande repolist seule :
[root@centos8 ~]# dnf repolist repo id repo name appstream CentOS Linux 8 - AppStream baseos CentOS Linux 8 - BaseOS epel Extra Packages for Enterprise Linux 8 - x86_64 epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64 extras CentOS Linux 8 - Extras
3.4 - Rechercher des Paquets
Pour lister tous les paquets installés et disponibles il convient d'utiliser la commande list :
[root@centos8 ~]# dnf list | more Last metadata expiration check: 2:31:07 ago on Tue 20 Apr 2021 03:34:31 PM EDT. Installed Packages NetworkManager.x86_64 1:1.26.0-12.el8_3 @BaseOS NetworkManager-libnm.x86_64 1:1.26.0-12.el8_3 @BaseOS NetworkManager-team.x86_64 1:1.26.0-12.el8_3 @BaseOS NetworkManager-tui.x86_64 1:1.26.0-12.el8_3 @BaseOS PackageKit.x86_64 1.1.12-6.el8 @AppStream PackageKit-glib.x86_64 1.1.12-6.el8 @AppStream abattis-cantarell-fonts.noarch 0.0.25-4.el8 @AppStream acl.x86_64 2.2.53-1.el8 @BaseOS adcli.x86_64 0.8.2-7.el8 @BaseOS adwaita-cursor-theme.noarch 3.28.0-2.el8 @appstream adwaita-icon-theme.noarch 3.28.0-2.el8 @appstream alsa-lib.x86_64 1.2.3.2-1.el8 @appstream at.x86_64 3.1.20-11.el8 @BaseOS at-spi2-atk.x86_64 2.26.2-1.el8 @appstream at-spi2-core.x86_64 2.28.0-1.el8 @appstream atk.x86_64 2.28.1-1.el8 --More--
Pour ne lister que les paquets installés, la commande list prend l'option installed :
[root@centos8 ~]# dnf list installed | more Installed Packages NetworkManager.x86_64 1:1.26.0-12.el8_3 @BaseOS NetworkManager-libnm.x86_64 1:1.26.0-12.el8_3 @BaseOS NetworkManager-team.x86_64 1:1.26.0-12.el8_3 @BaseOS NetworkManager-tui.x86_64 1:1.26.0-12.el8_3 @BaseOS PackageKit.x86_64 1.1.12-6.el8 @AppStream PackageKit-glib.x86_64 1.1.12-6.el8 @AppStream abattis-cantarell-fonts.noarch 0.0.25-4.el8 @AppStream acl.x86_64 2.2.53-1.el8 @BaseOS adcli.x86_64 0.8.2-7.el8 @BaseOS adwaita-cursor-theme.noarch 3.28.0-2.el8 @appstream adwaita-icon-theme.noarch 3.28.0-2.el8 @appstream alsa-lib.x86_64 1.2.3.2-1.el8 @appstream at.x86_64 3.1.20-11.el8 @BaseOS at-spi2-atk.x86_64 2.26.2-1.el8 @appstream at-spi2-core.x86_64 2.28.0-1.el8 @appstream atk.x86_64 2.28.1-1.el8 @appstream --More--
Pour ne lister que les paquets disponibles, la commande list prend l'option available :
[root@centos8 ~]# dnf list available | more Last metadata expiration check: 2:40:08 ago on Tue 20 Apr 2021 03:34:31 PM EDT. Available Packages 3proxy.x86_64 0.8.13-1.el8 epel AusweisApp2.x86_64 1.20.2-10.el8 epel AusweisApp2-data.noarch 1.20.2-10.el8 epel AusweisApp2-doc.noarch 1.20.2-10.el8 epel BackupPC.x86_64 4.4.0-1.el8 epel BackupPC-XS.x86_64 0.62-1.el8 epel BibTool.x86_64 2.68-1.el8 epel CCfits.x86_64 2.5-14.el8 epel CCfits-devel.x86_64 2.5-14.el8 epel CCfits-doc.noarch 2.5-14.el8 epel CGSI-gSOAP.x86_64 1.3.11-7.el8 epel CGSI-gSOAP-devel.x86_64 1.3.11-7.el8 epel CUnit.i686 2.1.3-17.el8 appstream CUnit.x86_64 2.1.3-17.el8 appstream CharLS.x86_64 2.0.0-6.el8 epel CharLS-devel.x86_64 2.0.0-6.el8 --More--
Pour rechercher une chaîne dans le nom ou dans la description courte du paquet, il convient d'utiliser la commande search :
[root@centos8 ~]# dnf search httpd Last metadata expiration check: 2:41:18 ago on Tue 20 Apr 2021 03:34:31 PM EDT. ================================= Name Exactly Matched: httpd ================================= httpd.x86_64 : Apache HTTP Server ================================ Name & Summary Matched: httpd ================================ centos-logos-httpd.noarch : CentOS-related icons and pictures used by httpd keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as Keycloak client lighttpd-fastcgi.x86_64 : FastCGI module and spawning helper for lighttpd and PHP configuration lighttpd-filesystem.noarch : The basic directory layout for lighttpd lighttpd-mod_authn_gssapi.x86_64 : Authentication module for lighttpd that uses GSSAPI lighttpd-mod_authn_mysql.x86_64 : Authentication module for lighttpd that uses a MySQL database lighttpd-mod_authn_pam.x86_64 : Authentication module for lighttpd that uses PAM lighttpd-mod_mysql_vhost.x86_64 : Virtual host module for lighttpd that uses a MySQL database pagure-web-apache-httpd.noarch : Apache HTTPD configuration for Pagure python3-keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as Keycloak : client radicale3-httpd.noarch : httpd config for Radicale ===================================== Name Matched: httpd ===================================== httpd-devel.x86_64 : Development interfaces for the Apache HTTP server httpd-filesystem.noarch : The basic directory layout for the Apache HTTP server httpd-manual.noarch : Documentation for the Apache HTTP server httpd-tools.x86_64 : Tools for use with the Apache HTTP Server libmicrohttpd.i686 : Lightweight library for embedding a webserver in applications libmicrohttpd.x86_64 : Lightweight library for embedding a webserver in applications lighttpd.x86_64 : Lightning fast webserver with light system requirements perl-Test-Fake-HTTPD.noarch : Fake HTTP server module for testing sysusage-httpd.noarch : Apache configuration for sysusage =================================== Summary Matched: httpd ==================================== mod_auth_mellon.x86_64 : A SAML 2.0 authentication module for the Apache Httpd Server mod_dav_svn.x86_64 : Apache httpd module for Subversion server
Pour ne rechercher que la chaîne dans le nom du paquet, utilisez la commande list :
root@centos8 ~]# dnf list httpd Last metadata expiration check: 0:08:16 ago on Wed 21 Apr 2021 12:54:45 AM EDT. Available Packages httpd.x86_64 2.4.37-30.module_el8.3.0+561+97fdbbcc appstream
Pour rechercher le paquet qui contient l'exécutable httpd, il convient d'utiliser la commande provides :
[root@centos8 ~]# dnf provides httpd Last metadata expiration check: 0:03:35 ago on Wed 21 Apr 2021 12:54:45 AM EDT. httpd-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64 : Apache HTTP Server Repo : appstream Matched from: Provide : httpd = 2.4.37-30.module_el8.3.0+561+97fdbbcc
Pour rechercher tout paquet commençant par kerne, utilisez la commande suivante :
[root@centos8 ~]# dnf list kerne\* Last metadata expiration check: 0:00:24 ago on Wed 21 Apr 2021 12:54:45 AM EDT. Installed Packages kernel.x86_64 4.18.0-147.8.1.el8_1 @BaseOS kernel.x86_64 4.18.0-240.22.1.el8_3 @BaseOS kernel-core.x86_64 4.18.0-147.8.1.el8_1 @BaseOS kernel-core.x86_64 4.18.0-240.22.1.el8_3 @BaseOS kernel-modules.x86_64 4.18.0-147.8.1.el8_1 @BaseOS kernel-modules.x86_64 4.18.0-240.22.1.el8_3 @BaseOS kernel-tools.x86_64 4.18.0-240.22.1.el8_3 @BaseOS kernel-tools-libs.x86_64 4.18.0-240.22.1.el8_3 @BaseOS Available Packages kernel-abi-whitelists.noarch 4.18.0-240.22.1.el8_3 baseos kernel-cross-headers.x86_64 4.18.0-240.22.1.el8_3 baseos kernel-debug.x86_64 4.18.0-240.22.1.el8_3 baseos kernel-debug-core.x86_64 4.18.0-240.22.1.el8_3 baseos kernel-debug-devel.x86_64 4.18.0-240.22.1.el8_3 baseos kernel-debug-modules.x86_64 4.18.0-240.22.1.el8_3 baseos kernel-debug-modules-extra.x86_64 4.18.0-240.22.1.el8_3 baseos kernel-devel.x86_64 4.18.0-240.22.1.el8_3 baseos kernel-doc.noarch 4.18.0-240.22.1.el8_3 baseos kernel-headers.x86_64 4.18.0-240.22.1.el8_3 baseos kernel-modules-extra.x86_64 4.18.0-240.22.1.el8_3 baseos kernel-rpm-macros.noarch 123-1.el8 appstream kernelshark.x86_64 2.7-8.el8 appstream
Pour lister les groupes de paquets, il convient d'utiliser la commande grouplist :
[root@centos8 ~]# dnf grouplist Last metadata expiration check: 1:49:11 ago on Tue 20 Apr 2021 09:37:31 PM EDT. Available Environment Groups: Server with GUI Server Workstation KDE Plasma Workspaces Virtualization Host Custom Operating System Installed Environment Groups: Minimal Install Available Groups: Container Management .NET Core Development RPM Development Tools Development Tools Graphical Administration Tools Headless Management Legacy UNIX Compatibility Network Servers Scientific Support Security Tools Smart Card Support System Tools Fedora Packager Xfce
3.5 - Obtenir de l'Information sur un Paquet et le Télécharger
Pour obtenir de l'information sur un paquet, il convient d'utiliser la commmande info :
[root@centos8 ~]# dnf info httpd Last metadata expiration check: 2:43:14 ago on Tue 20 Apr 2021 03:34:31 PM EDT. Available Packages Name : httpd Version : 2.4.37 Release : 30.module_el8.3.0+561+97fdbbcc Architecture : x86_64 Size : 1.7 M Source : httpd-2.4.37-30.module_el8.3.0+561+97fdbbcc.src.rpm Repository : appstream Summary : Apache HTTP Server URL : https://httpd.apache.org/ License : ASL 2.0 Description : The Apache HTTP Server is a powerful, efficient, and extensible : web server.
Pour télécharger sans installer un paquet, l'ancienne commande yumdownloader a été remplacée par la commande download de dnf :
[root@centos8 ~]# dnf download httpd Last metadata expiration check: 2:46:56 ago on Tue 20 Apr 2021 03:34:31 PM EDT. httpd-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64.rpm 4.0 MB/s | 1.7 MB 00:00
Ce paquet est téléchargé vers le répertoire courant :
[root@centos8 ~]# updatedb [root@centos8 ~]# locate httpd-2.4.37-30. /root/httpd-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64.rpm
3.6 - Installer un Paquet
Pour installer un paquet, dnf possède la commande install :
[root@centos8 ~]# dnf install httpd Last metadata expiration check: 2:58:37 ago on Tue 20 Apr 2021 03:34:31 PM EDT. Dependencies resolved. =============================================================================================== Package Arch Version Repository Size =============================================================================================== Installing: httpd x86_64 2.4.37-30.module_el8.3.0+561+97fdbbcc appstream 1.7 M Installing dependencies: apr x86_64 1.6.3-11.el8 appstream 125 k apr-util x86_64 1.6.1-6.el8 appstream 105 k centos-logos-httpd noarch 80.5-2.el8 baseos 24 k httpd-filesystem noarch 2.4.37-30.module_el8.3.0+561+97fdbbcc appstream 37 k httpd-tools x86_64 2.4.37-30.module_el8.3.0+561+97fdbbcc appstream 104 k mod_http2 x86_64 1.15.7-2.module_el8.3.0+477+498bb568 appstream 154 k Installing weak dependencies: apr-util-bdb x86_64 1.6.1-6.el8 appstream 25 k apr-util-openssl x86_64 1.6.1-6.el8 appstream 27 k Enabling module streams: httpd 2.4 Transaction Summary =============================================================================================== Install 9 Packages Total download size: 2.3 M Installed size: 6.0 M Is this ok [y/N]: n Operation aborted.
Pour répondre automatiquement oui à chaque question posée par dnf, utilisez l'option -y :
[root@centos8 ~]# dnf install httpd -y ... Installed: apr-1.6.3-11.el8.x86_64 apr-util-1.6.1-6.el8.x86_64 apr-util-bdb-1.6.1-6.el8.x86_64 apr-util-openssl-1.6.1-6.el8.x86_64 centos-logos-httpd-80.5-2.el8.noarch httpd-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64 httpd-filesystem-2.4.37-30.module_el8.3.0+561+97fdbbcc.noarch httpd-tools-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64 mod_http2-1.15.7-2.module_el8.3.0+477+498bb568.x86_64 Complete!
Il est possible de ré-installer un paquet avec la commande reinstall :
[root@centos8 ~]# dnf reinstall httpd Last metadata expiration check: 0:02:31 ago on Tue 20 Apr 2021 06:35:25 PM EDT. Dependencies resolved. =============================================================================================== Package Architecture Version Repository Size =============================================================================================== Reinstalling: httpd x86_64 2.4.37-30.module_el8.3.0+561+97fdbbcc appstream 1.7 M Transaction Summary =============================================================================================== Total download size: 1.7 M Installed size: 4.9 M Is this ok [y/N]: y
Pour installer un groupe de paquets, dnf possède la commande groupinstall :
[root@centos8 ~]# dnf groupinstall 'System Tools' Last metadata expiration check: 1:51:28 ago on Tue 20 Apr 2021 09:37:31 PM EDT. Dependencies resolved. ============================================================================================================= Package Architecture Version Repository Size ============================================================================================================= Installing group/module packages: NetworkManager-libreswan x86_64 1.2.10-4.el8 appstream 120 k cifs-utils x86_64 6.8-3.el8 baseos 96 k libreswan x86_64 3.32-7.el8_3 appstream 1.4 M nmap x86_64 2:7.70-5.el8 appstream 5.8 M openldap-clients x86_64 2.4.46-15.el8 baseos 202 k samba-client x86_64 4.12.3-12.el8.3 baseos 692 k setserial x86_64 2.17-45.el8 baseos 32 k tigervnc x86_64 1.10.1-9.el8_3 appstream 290 k tmux x86_64 2.7-1.el8 baseos 317 k xdelta x86_64 3.1.0-4.el8 baseos 96 k zsh x86_64 5.5.1-6.el8_1.2 baseos 2.9 M Installing dependencies: fltk x86_64 1.3.4-5.el8 appstream 590 k ldns x86_64 1.7.0-21.el8 appstream 166 k mesa-libGLU x86_64 9.0.0-15.el8 appstream 185 k nss-tools x86_64 3.53.1-17.el8_3 appstream 560 k tigervnc-icons noarch 1.10.1-9.el8_3 appstream 47 k tigervnc-license noarch 1.10.1-9.el8_3 appstream 38 k Installing Groups: System Tools Transaction Summary ============================================================================================================= Install 17 Packages Total download size: 13 M Installed size: 47 M Is this ok [y/N]: y
3.7 - Mettre à jour des Paquets
Pour vérifier la disponibilité des mises-à-jour, dnf possède la commande check-update :
[root@centos8 ~]# dnf check-update Last metadata expiration check: 1:38:50 ago on Tue 20 Apr 2021 09:37:31 PM EDT. epel-release.noarch 8-10.el8 epel procps-ng.x86_64 3.3.15-3.el8_3.1 baseos selinux-policy.noarch 3.14.3-54.el8_3.4 baseos selinux-policy-targeted.noarch 3.14.3-54.el8_3.4 baseos
Pour procéder à la mise à jour de tous les paquets, dnf possède les commandes update et upgrade. Il est aussi possible de spécifier un paquet spécifique :
[root@centos8 ~]# dnf update epel-release.noarch Last metadata expiration check: 1:43:33 ago on Tue 20 Apr 2021 09:37:31 PM EDT. Dependencies resolved. ============================================================================================================= Package Architecture Version Repository Size ============================================================================================================= Upgrading: epel-release noarch 8-10.el8 epel 22 k Transaction Summary ============================================================================================================= Upgrade 1 Package Total download size: 22 k Is this ok [y/N]: y
La gestion des mises à jour des groupes de paquets se fait en utilisant la commande groupupdate :
[root@centos8 ~]# dnf groupupdate 'System Tools' Last metadata expiration check: 1:55:43 ago on Tue 20 Apr 2021 09:37:31 PM EDT. Dependencies resolved. ============================================================================================================= Package Architecture Version Repository Size ============================================================================================================= Installing Groups: System Tools Transaction Summary ============================================================================================================= Is this ok [y/N]: y Complete!
3.8 - Supprimer des Paquets
Pour supprimer un paquet, il convient d'utiliser la commande remove :
[root@centos8 ~]# dnf remove httpd Dependencies resolved. ============================================================================================================= Package Architecture Version Repository Size ============================================================================================================= Removing: httpd x86_64 2.4.37-30.module_el8.3.0+561+97fdbbcc @appstream 4.9 M Removing unused dependencies: apr x86_64 1.6.3-11.el8 @appstream 260 k apr-util x86_64 1.6.1-6.el8 @appstream 231 k apr-util-bdb x86_64 1.6.1-6.el8 @appstream 12 k apr-util-openssl x86_64 1.6.1-6.el8 @appstream 20 k centos-logos-httpd noarch 80.5-2.el8 @baseos 1.9 k httpd-filesystem noarch 2.4.37-30.module_el8.3.0+561+97fdbbcc @appstream 400 httpd-tools x86_64 2.4.37-30.module_el8.3.0+561+97fdbbcc @appstream 195 k mod_http2 x86_64 1.15.7-2.module_el8.3.0+477+498bb568 @appstream 393 k Transaction Summary ============================================================================================================= Remove 9 Packages Freed space: 6.0 M Is this ok [y/N]: y
Pour supprimer un groupe de paquets, il convient d'utiliser la commande groupremove :
[root@centos8 ~]# dnf groupremove 'System Tools' Dependencies resolved. ============================================================================================================= Package Architecture Version Repository Size ============================================================================================================= Removing: NetworkManager-libreswan x86_64 1.2.10-4.el8 @appstream 420 k cifs-utils x86_64 6.8-3.el8 @baseos 192 k libreswan x86_64 3.32-7.el8_3 @appstream 4.7 M nmap x86_64 2:7.70-5.el8 @appstream 24 M openldap-clients x86_64 2.4.46-15.el8 @baseos 612 k samba-client x86_64 4.12.3-12.el8.3 @baseos 2.3 M setserial x86_64 2.17-45.el8 @baseos 37 k tigervnc x86_64 1.10.1-9.el8_3 @appstream 849 k tmux x86_64 2.7-1.el8 @baseos 781 k xdelta x86_64 3.1.0-4.el8 @baseos 184 k zsh x86_64 5.5.1-6.el8_1.2 @baseos 7.2 M Removing unused dependencies: fltk x86_64 1.3.4-5.el8 @appstream 2.8 M ldns x86_64 1.7.0-21.el8 @appstream 536 k mesa-libGLU x86_64 9.0.0-15.el8 @appstream 490 k nss-tools x86_64 3.53.1-17.el8_3 @appstream 2.2 M tigervnc-icons noarch 1.10.1-9.el8_3 @appstream 33 k tigervnc-license noarch 1.10.1-9.el8_3 @appstream 18 k Removing Groups: System Tools Transaction Summary ============================================================================================================= Remove 17 Packages Freed space: 47 M Is this ok [y/N]: y
Pour surppimer les dépendances inutilisées, utilisez la commande autoremove :
[root@centos8 ~]# dnf autoremove Last metadata expiration check: 0:08:52 ago on Wed 21 Apr 2021 12:39:54 AM EDT. Dependencies resolved. ============================================================================================================= Package Architecture Version Repository Size ============================================================================================================= Removing: fipscheck x86_64 1.5.0-4.el8 @BaseOS 47 k fipscheck-lib x86_64 1.5.0-4.el8 @BaseOS 12 k grub2-tools-efi x86_64 1:2.02-90.el8_3.1 @BaseOS 2.0 M Transaction Summary ============================================================================================================= Remove 3 Packages Freed space: 2.1 M Is this ok [y/N]: y
Pour nettoyer le cache des paquets téléchargés, utilisez la commande clean all :
[root@centos8 ~]# dnf clean all 58 files removed
LAB #4 - Les Bibliothèques Partagées
4.1 - 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 :
[root@centos8 ~]# dnf install mc Last metadata expiration check: 0:20:35 ago on Wed 21 Apr 2021 12:54:45 AM EDT. Dependencies resolved. ============================================================================================================= Package Architecture Version Repository Size ============================================================================================================= Installing: mc x86_64 1:4.8.19-9.el8 appstream 1.9 M Transaction Summary ============================================================================================================= Install 1 Package Total download size: 1.9 M Installed size: 6.8 M Is this ok [y/N]: y
4.2 - La Commande ldd
Pour déterminer quelles sont les bibliothèques liées à une application, il convient d'utiliser la commande ldd :
[root@centos8 ~]# ldd /usr/bin/mc linux-vdso.so.1 (0x00007fff39386000) libslang.so.2 => /lib64/libslang.so.2 (0x00007f0a74152000) libgpm.so.2 => /lib64/libgpm.so.2 (0x00007f0a73f4b000) libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00007f0a73d47000) libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f0a73a2e000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0a7380e000) libc.so.6 => /lib64/libc.so.6 (0x00007f0a7344b000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f0a73247000) libm.so.6 => /lib64/libm.so.6 (0x00007f0a72ec5000) libncurses.so.6 => /lib64/libncurses.so.6 (0x00007f0a72c9a000) libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f0a72a6d000) libgnutls.so.30 => /lib64/libgnutls.so.30 (0x00007f0a7267c000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f0a7240b000) /lib64/ld-linux-x86-64.so.2 (0x00007f0a74994000) libp11-kit.so.0 => /lib64/libp11-kit.so.0 (0x00007f0a720d8000) libidn2.so.0 => /lib64/libidn2.so.0 (0x00007f0a71eba000) libunistring.so.2 => /lib64/libunistring.so.2 (0x00007f0a71b39000) libtasn1.so.6 => /lib64/libtasn1.so.6 (0x00007f0a71926000) libnettle.so.6 => /lib64/libnettle.so.6 (0x00007f0a716ec000) libhogweed.so.4 => /lib64/libhogweed.so.4 (0x00007f0a714bb000) libgmp.so.10 => /lib64/libgmp.so.10 (0x00007f0a71223000) libffi.so.6 => /lib64/libffi.so.6 (0x00007f0a7101a000)
Afin de comprendre ce qui se passe dans le cas où une bibliothèque est manquante, renommez la bibliothèque /usr/lib/libslang.so.2 en /usr/lib/libslang.so.2.old :
[root@centos8 ~]# mv /lib64/libslang.so.2 /lib64/libslang.so.2.old
Exécutez de nouveau la commande ldd. Vous obtiendrez un résultat similaire à celui-ci :
[root@centos8 ~]# ldd /usr/bin/mc linux-vdso.so.1 (0x00007fff669a6000) libslang.so.2 => not found libgpm.so.2 => /lib64/libgpm.so.2 (0x00007fc6ccba0000) libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00007fc6cc99c000) libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007fc6cc683000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fc6cc463000) libc.so.6 => /lib64/libc.so.6 (0x00007fc6cc0a0000) libncurses.so.6 => /lib64/libncurses.so.6 (0x00007fc6cbe75000) libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fc6cbc48000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fc6cba44000) libgnutls.so.30 => /lib64/libgnutls.so.30 (0x00007fc6cb653000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fc6cb3e2000) /lib64/ld-linux-x86-64.so.2 (0x00007fc6cd112000) libp11-kit.so.0 => /lib64/libp11-kit.so.0 (0x00007fc6cb0af000) libidn2.so.0 => /lib64/libidn2.so.0 (0x00007fc6cae91000) libunistring.so.2 => /lib64/libunistring.so.2 (0x00007fc6cab10000) libtasn1.so.6 => /lib64/libtasn1.so.6 (0x00007fc6ca8fd000) libnettle.so.6 => /lib64/libnettle.so.6 (0x00007fc6ca6c3000) libhogweed.so.4 => /lib64/libhogweed.so.4 (0x00007fc6ca492000) libgmp.so.10 => /lib64/libgmp.so.10 (0x00007fc6ca1fa000) libffi.so.6 => /lib64/libffi.so.6 (0x00007fc6c9ff1000)
Notez la présence de la ligne libslang.so.2 ⇒ not found. Compte tenu de la bibliothèque partagée manquante, le programme mc ne peut plus être lancé :
[root@centos8 ~]# mc mc: error while loading shared libraries: libslang.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@centos8 ~]# mv /lib64/libslang.so.2.old /lib64/libslang.so.2 [root@centos8 ~]# ldd /usr/bin/mc linux-vdso.so.1 (0x00007fff4b8de000) libslang.so.2 => /lib64/libslang.so.2 (0x00007f670a991000) libgpm.so.2 => /lib64/libgpm.so.2 (0x00007f670a78a000) libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00007f670a586000) libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f670a26d000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f670a04d000) libc.so.6 => /lib64/libc.so.6 (0x00007f6709c8a000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f6709a86000) libm.so.6 => /lib64/libm.so.6 (0x00007f6709704000) libncurses.so.6 => /lib64/libncurses.so.6 (0x00007f67094d9000) libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f67092ac000) libgnutls.so.30 => /lib64/libgnutls.so.30 (0x00007f6708ebb000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f6708c4a000) /lib64/ld-linux-x86-64.so.2 (0x00007f670b1d3000) libp11-kit.so.0 => /lib64/libp11-kit.so.0 (0x00007f6708917000) libidn2.so.0 => /lib64/libidn2.so.0 (0x00007f67086f9000) libunistring.so.2 => /lib64/libunistring.so.2 (0x00007f6708378000) libtasn1.so.6 => /lib64/libtasn1.so.6 (0x00007f6708165000) libnettle.so.6 => /lib64/libnettle.so.6 (0x00007f6707f2b000) libhogweed.so.4 => /lib64/libhogweed.so.4 (0x00007f6707cfa000) libgmp.so.10 => /lib64/libgmp.so.10 (0x00007f6707a62000) libffi.so.6 => /lib64/libffi.so.6 (0x00007f6707859000)
4.3 - Le fichier /etc/ld.so.conf
Le fichier /etc/ld.so.conf est utilisé pour configurer le cache /etc/ld.so.cache :
[root@centos8 ~]# cat /etc/ld.so.conf include 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@centos8 ~]# ls -l /etc/ld.so.conf.d/ total 16 -rw-r--r--. 1 root root 26 Mar 1 10:21 bind-export-x86_64.conf -r--r--r--. 1 root root 67 Apr 9 2020 kernel-4.18.0-147.8.1.el8_1.x86_64.conf -r--r--r--. 1 root root 67 Apr 8 15:09 kernel-4.18.0-240.22.1.el8_3.x86_64.conf -rw-r--r--. 1 root root 17 Nov 3 19:38 libiscsi-x86_64.conf
Par exemple, le contenu du fichier bind-export-x86_64.conf est :
[root@centos8 ~]# cat /etc/ld.so.conf.d/bind-export-x86_64.conf /usr/lib64//bind9-export/
4.4 - 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@centos8 ~]# ldconfig -p | more 546 libs found in cache `/etc/ld.so.cache' p11-kit-trust.so (libc6,x86-64) => /lib64/p11-kit-trust.so libzstd.so.1 (libc6,x86-64) => /lib64/libzstd.so.1 libz.so.1 (libc6,x86-64) => /lib64/libz.so.1 libyaml-0.so.2 (libc6,x86-64) => /lib64/libyaml-0.so.2 libyajl.so.2 (libc6,x86-64) => /lib64/libyajl.so.2 libxtables.so.12 (libc6,x86-64) => /lib64/libxtables.so.12 libxslt.so.1 (libc6,x86-64) => /lib64/libxslt.so.1 libxshmfence.so.1 (libc6,x86-64) => /lib64/libxshmfence.so.1 libxml2.so.2 (libc6,x86-64) => /lib64/libxml2.so.2 libxkbcommon.so.0 (libc6,x86-64) => /lib64/libxkbcommon.so.0 libxcb.so.1 (libc6,x86-64) => /lib64/libxcb.so.1 libxcb-xvmc.so.0 (libc6,x86-64) => /lib64/libxcb-xvmc.so.0 libxcb-xv.so.0 (libc6,x86-64) => /lib64/libxcb-xv.so.0 libxcb-xtest.so.0 (libc6,x86-64) => /lib64/libxcb-xtest.so.0 libxcb-xselinux.so.0 (libc6,x86-64) => /lib64/libxcb-xselinux.so.0 libxcb-xkb.so.1 (libc6,x86-64) => /lib64/libxcb-xkb.so.1 libxcb-xinput.so.0 (libc6,x86-64) => /lib64/libxcb-xinput.so.0 libxcb-xinerama.so.0 (libc6,x86-64) => /lib64/libxcb-xinerama.so.0 libxcb-xf86dri.so.0 (libc6,x86-64) => /lib64/libxcb-xf86dri.so.0 libxcb-xfixes.so.0 (libc6,x86-64) => /lib64/libxcb-xfixes.so.0 libxcb-sync.so.1 (libc6,x86-64) => /lib64/libxcb-sync.so.1 libxcb-shm.so.0 (libc6,x86-64) => /lib64/libxcb-shm.so.0 --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.
Copyright © 2024 Hugh Norris.