On a Linux system, it is possible to install software in two ways:
- Using an installation package;
- Compiling from source files.
!!! Note Installing from source is not covered here. As a rule, you should use the package method unless the software you want is not available via the package manager. The reason for this is that dependencies are generally managed by the package system, whereas with source, you need to manage the dependencies manually.
The package: This is a single file containing all the data needed to install the program. It can be executed directly on the system from a software repository.
The source files : Some software is not provided in packages ready to be installed, but via an archive containing the source files. It is up to the administrator to prepare these files and compile them to install the program.
RPM : RedHat Package Manager¶
RPM (RedHat Package Manager) is a software management system. It is possible to install, uninstall, update or check software contained in packages.
RPM is the format used by all RedHat based distributions (RockyLinux, Fedora, CentOS, SuSe, Mandriva, ...). Its equivalent in the Debian world is DPKG (Debian Package).
The name of an RPM package follows a specific nomenclature:
The rpm command allows you to install a package.
rpm [-i][-U] package.rpm [-e] package
Example (for a package named 'package'):
[root]# rpm -ivh package.rpm
||Installs the package.|
||Updates an already installed package.|
||Uninstalls the package.|
||Displays a progress bar.|
||Informs about the progress of the operation.|
||Tests the command without executing it.|
rpm command also allows you to query the system package database by adding the
It is possible to execute several types of queries to obtain different information about the installed packages. The RPM database is located in the directory
[root]# rpm -qa
This command queries all the packages installed on the system.
rpm -q [-a][-i][-l] package [-f] file
[root]# rpm -qil package [root]# rpm -qf /path/to/file
||Lists all packages installed on the system.|
||Displays the package information.|
||Lists the files contained in the package.|
||Shows the name of the package containing the specified file.|
||The list of packages is given by installation date (the last installed packages appear first).|
!!! Warning After the
-q option, the package name must be exact. Metacharacters (wildcards) are not supported.
!!! Tip However, it is possible to list all installed packages and filter with the
Example: list the last installed packages:
sudo rpm -qa --last | head NetworkManager-config-server-1.26.0-13.el8.noarch Mon 24 May 2021 02:34:00 PM CEST iwl2030-firmware-126.96.36.199-101.el8.1.noarch Mon 24 May 2021 02:34:00 PM CEST iwl2000-firmware-188.8.131.52-101.el8.1.noarch Mon 24 May 2021 02:34:00 PM CEST iwl135-firmware-184.108.40.206-101.el8.1.noarch Mon 24 May 2021 02:34:00 PM CEST iwl105-firmware-220.127.116.11-101.el8.1.noarch Mon 24 May 2021 02:34:00 PM CEST iwl100-firmware-18.104.22.168-101.el8.1.noarch Mon 24 May 2021 02:34:00 PM CEST iwl1000-firmware-22.214.171.124-101.el8.1.noarch Mon 24 May 2021 02:34:00 PM CEST alsa-sof-firmware-1.5-2.el8.noarch Mon 24 May 2021 02:34:00 PM CEST iwl7260-firmware-126.96.36.199-101.el8.1.noarch Mon 24 May 2021 02:33:59 PM CEST iwl6050-firmware-188.8.131.52-101.el8.1.noarch Mon 24 May 2021 02:33:59 PM CEST
Example: list the installation history of the kernel:
sudo rpm -qa --last kernel kernel-4.18.0-305.el8.x86_64 Tue 25 May 2021 06:04:56 AM CEST kernel-4.18.0-240.22.1.el8.x86_64 Mon 24 May 2021 02:33:35 PM CEST
Example: list all installed packages with a specific name using
sudo dnf list installed | grep httpd centos-logos-httpd.noarch 80.5-2.el8 @baseos httpd.x86_64 2.4.37-30.module_el8.3.0+561+97fdbbcc @appstream httpd-filesystem.noarch 2.4.37-30.module_el8.3.0+561+97fdbbcc @appstream httpd-tools.x86_64 2.4.37-30.module_el8.3.0+561+97fdbbcc @appstream
DNF : Dandified Yum¶
DNF (Dandified Yum) is a software package manager, successor of YUM (Yellow dog Updater Modified). It works with RPM** packages grouped in a local or remote repository (a directory for storing packages). For the most common commands, its usage is identical to that of
dnf command allows the management of packages by comparing those installed on the system with those in the repositories defined on the server. It also automatically installs dependencies, if they are also present in the repositories.
dnf is the manager used by many RedHat based distributions (RockyLinux, Fedora, CentOS, ...). Its equivalent in the Debian world is APT (Advanced Packaging Tool).
The dnf command allows you to install a package by specifying only the short name.
dnf [install][remove][list all][search][info] package
[root]# dnf install tree
Only the short name of the package is required.
||Installs the package.|
||Uninstall the package.|
||Lists the packages already in the repository.|
||Search for a package in the repository.|
||Search for a command.|
||Displays the package information.|
dnf list command lists all the packages installed on the system and present in the repository. It accepts several parameters:
||Lists the installed packages and then those available on the repositories.|
||Lists only the packages available for installation.|
||Lists packages that can be upgraded.|
||Lists the packages made obsolete by higher versions available.|
||Lists the latest packages added to the repository.|
Example of a search for the
[root]# dnf provides */semanage
How DNF works¶
The DNF manager relies on one or more configuration files to target the repositories containing the RPM packages.
These files are located in
/etc/yum.repos.d/ and must end with
.repo in order to be used by DNF.
.repo file consists of at least the following information, one directive per line.
[baseos] # Short name of the repository name=Rocky Linux $releasever - BaseOS # Short name of the repository #Detailed name mirrorlist=http://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever # http address of a list or mirror #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/ # http address for direct access gpgcheck=1 # Repository requiring a signature enabled=1 # Activated =1, or not activated =0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial # GPG public key path
By default, the
enabled directive is absent which means that the repository is enabled. To disable a repository, you must specify the
The EPEL repository¶
EPEL (Extra Packages for Enterprise Linux) is a repository containing additional software packages for Enterprise Linux, which includes RedHat Enterprise Linux (RHEL), RockyLinux, CentOS, etc.
Download and install the rpm from the repository:
If you are behind an internet proxy:
[root]# export http_proxy=http://172.16.1.10:8080
[root]# dnf install epel-release