Red Hat Certified System Administration 8



Chapter 09: Managing Software


Sommaire

  • Installing Softwares
  • Managing Software Packages with RPM
  • Managing Software Packages with YUM
  • Managing Software Packages with DNF


Installing Softwares



Managing Software Packages with RPM


Red 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 dependencies

Syntax

[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 YUM


Yellowdog Updater Modified (YUM)

Features

  1. Install rpm packages from rpm repositories
  2. Dependencies Management

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 packages

Check available updates of all installed packages
[root@lab ~]# yum check-update

Check available updates of a specific package
[root@lab ~]# yum check-update package_name

Update a single package
[root@lab ~]# yum update package_name
NB: you can use the -y option to automatically answer yes to any questions that yum asks

Update all packages and their dependencies
[root@lab ~]# yum update

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 packages

yum list and related commands provide information about packages, package groups, and repositories
Example: 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 Package

repoquery 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.conf yum configuration file
/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 Cache

By 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 repository
NB: createrepo package must be installed and has dependencies with these packages (deltarpm , python-deltarpm)

yum repolist list of repositories

Repositories Configuration

Upgrading the System Off-line with ISO and Yum

  1. mkdir mount_dir
  2. mount -o loop iso_name mount_dir
  3. cp mount_dir/media.repo /etc/yum.repos.d/new.repo
  4. Add the following line into the /etc/yum .repos.d/new.repo file: baseurl=file://mount_dir
  5. yum update
  6. umount mount_dir
  7. rmdir mount_dir
  8. rm /etc/yum.repos.d/new.repo

  NB : the -o loop option is required to mount the file as a block device.


Managing Modules

The 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 DNF


dnf

[root@redhat ~]# dnf update --refresh list Repositories

[root@redhat ~]# dnf module list

[root@redhat ~]# dnf install

[root@redhat ~]# dnf module list php



Eninam BAGNABANA     |         |     bagnadavid@outlook.fr     |