![]() | Red Hat Certified System Administration 8 |
Chapter 09: Managing SoftwareSommaire
Installing SoftwaresManaging Software Packages with RPMRed Hat Package Manager (RPM)L'outil rpm est utilisé pour installer les packages dont on connait le chemin d'accès (URL) rpm tool don’t manage dependenciesSyntax[root@lab ~]# rpm –option package [+]Examples[root@lab ~]# rpm –i /var/ftp/rpm/MySQL-python-1.2.3-0.3.c1.1.el6.i686.rpm Local file[root@lab ~]# rpm –i http://mirror.cisp.com/CentOS/6/os/i386/Packages/MySQL-python-1.2.3-0.3.c1.1.el6.i686.rpm Online Repository File [root@redhat ~]# rpm -ivh /DATA/DVD/BaseOS/Packages/mailx-12.5-29.el8.x86_64.rpm Some Syntaxes[root@lab ~]# rpm –qa all installed packages list[root@lab ~]# rpm –qf script or binary file give which installed package create a script or binary file [root@lab ~]# rpm –ivh package --nodeps dependencies ignorance installation [root@lab ~]# rpm –qi packagename to display information about package [root@lab ~]# rpm –ql packagename liste des fichiers installés par un package [root@lab ~]# rpm –qR packagename liste des dépendances d un package [root@lab ~]# rpm –i packagename installe un package [root@lab ~]# rpm –e packagename desinstalle un package (no .rpm at end) [root@lab ~]# rpm -q --info package_name information concernant un package [root@lab ~]# rpm –U packagename mise a jour du package [root@lab ~]# rpm -i kernel installe un nouveau noyau Managing Software Packages with YUMYellowdog Updater Modified (YUM)Features
By default Red Hat has his repositories which are accessible after RHN (Red Hat Network) subscription, but we are able to create our own repository on ftp server or locally on machine NB: le programme yum va vérifier la liste des dépôts (sites internet de stockage des paquets) dans les fichiers d’extension '.repo' du dossier /etc/yum.repos.d/ puis y va chercher les packages nécessaires à l’installation du software. Par défaut il existe dans le système le fichier /etc/yum.repos.d/redhat.repo on peut en créer d’autres et c’est préférable car si on ajoute des dépôts dans le fichier par défaut, on risque de les perdre lors d’une mise à jour du système. Packages Installation[root@lab ~]# yum install package_name[root@lab ~]# yum install package_name package_name… [root@lab ~]# yum remove package_name… remove a package [root@lab ~]# yum groupinstall package_group : Install Packages Group Update packagesCheck available updates of all installed packagesCheck available updates of a specific package Update a single package NB: you can use the -y option to automatically answer yes to any questions that yum asks Update all packages and their dependencies Search packages[root@lab ~]# yum search term search all RPM package names, descriptions and summaries. displays the list of matches for each term NB: The yum search command is useful for searching for packages you do not know the name of, but for which you know a related term.Example [root@lab ~]# yum search nmap List packagesyum list and related commands provide information about packages, package groups, and repositoriesExample: yum list abrt-addon\* abrt-plugin\* search packages which name begin with abrt-addon or abrt-plugin [root@lab ~]# yum list all Lists all installed and available packages [root@lab ~]# yum list installed Lists all packages installed on your system [root@lab ~]# yum list available Lists all available packages in all enabled repositories. [root@lab ~]# yum grouplist Lists all package groups [root@lab ~]# yum repolist Lists the repository ID, name, and number of packages it provides for each enabled repository Displaying Package Information[root@lab ~]# yum info package_name[root@lab ~]# yumdb info package_name query the Yum database for alternative and useful information about a package. This command provides additional information about a package, including the checksum of the package (and algorithm used to produce it, such as SHA-256), Listing Files Contained in a Packagerepoquery is a program for querying information from yum repositories similarly to rpm queries[root@lab ~]# repoquery --list package_name Yum Files and Directories/etc/yum.repos.d/ yum repositories files default directory /etc/yum.repos.d/redhat.repo default yum repositories file We can create others in the same directory in this form /etc/yum.repos.d/repofile.repo Repository Configuration file [+] [2 +] Yum CacheBy default, yum deletes downloaded data files when they are no longer needed after a successful operation. However, you can enable caching, so that the package files downloaded by yum stay in cache directories.Yum stores temporary files in the /var/cache/yum/$basearch/$releasever/ directory You can find the values for the $basearch and $releasever variables in the output of the yum version command To change the default cache location, modify the cachedir option in the [main] section of the /etc/yum.conf configuration file. To retain the cache of packages after a successful installation, add the following text to the [main] section of /etc/yum.conf. keepcache = 1 To download and install repositories from the Red Hat Network (RHN), a current subscription is required Local Repository#createrepo directory make a directory to be packages repositoryNB: createrepo package must be installed and has dependencies with these packages (deltarpm , python-deltarpm) yum repolist list of repositories Repositories ConfigurationUpgrading the System Off-line with ISO and Yum
Managing ModulesThe yum command in RHEL 8 supports working with modules using the yum module command. To find out which modules are available, you may want to start with the yum module list command.Managing Software Packages with DNFdnf[root@redhat ~]# dnf update --refresh list Repositories[root@redhat ~]# dnf module list [root@redhat ~]# dnf install [root@redhat ~]# dnf module list php |