Chapter 2. Installing software with yum
2.1. Introduction to installing software on Red Hat Enterprise Linux 8
On Red Hat Enterprise Linux 8, installing software is ensured by the new version of the YUM tool, which is based on the DNF technology (YUM v4).
YUM v4 has the following advantages over the previous YUM v3 used on Red Hat Enterprise Linux 7:
- Increased performance
- New features available, most significantly the support for managing the modular content
- Well-designed stable API for integration with tooling
For detailed information about differences between the new YUM tool and the previous version YUM v3 from Red Hat Enterprise Linux 7, see Changes in DNF CLI compared to YUM.
Note, that upstream calls this tool DNF. As a result, some output returned by the new YUM tool in Red Hat Enterprise Linux 8 mentions DNF, and upstream documentation identifies the technology as DNF.
For installing software, you can use the
yum command and its particular options in the same way as on Red Hat Enterprise Linux 7.
Selected yum plug-ins and utilities have been ported to the new DNF back end, and can be installed under the same names as in Red Hat Enterprise Linux 7. They also provide compatibility symlinks, so the binaries, configuration files and directories can be found in usual locations.
Note that the legacy Python API provided by YUM v3 is no longer available. Users are advised to migrate their plug-ins and scripts to the new API provided by YUM v4 (DNF Python API), which is stable and fully supported. The DNF Python API is available here.
The Libdnf and Hawkey APIs (both C and Python) are unstable, and will likely change during RHEL 8 life cycle.
2.1.1. Application streams
Red Hat Enterprise Linux 8.0 introduces the concept of Application Streams. Multiple versions of user space components are now delivered and updated more frequently than the core operating system packages. This provides greater flexibility to customize Red Hat Enterprise Linux without impacting the underlying stability of the platform or specific deployments.
Components made available as Application Streams can be packaged as modules or RPM packages and are delivered through the AppStream repository in RHEL 8. Each Application Stream component has a given life cycle. For details, see Red Hat Enterprise Linux Life Cycle.
Modules are collections of packages representing a logical unit: an application, a language stack, a database, or a set of tools. These packages are built, tested, and released together.
Module streams represent versions of the Application Stream components. For example, two streams (versions) of the PostgreSQL database server are available in the postgresql module: PostgreSQL 10 (the default stream) and PostgreSQL 9.6. Only one module stream can be installed on the system. Different versions can be used in separate containers.
Detailed module commands are described in the Installing, managing, and removing user-space components document. For a list of modules available in AppStream, see the Package manifest.
2.2. Introduction to yum functionality
yum is the Red Hat package manager that is able to query for information about available packages, fetch packages from repositories, install and uninstall them, and update an entire system to the latest available version. Yum performs automatic dependency resolution when updating, installing, or removing packages, and thus is able to automatically determine, fetch, and install all available dependent packages.
yum can be configured with new, additional repositories, or package sources, and also provides many plug-ins which enhance and extend its capabilities. Yum enables easy and simple package management.
yum provides secure package management by enabling Gnu Privacy Guard (GPG), also known as GnuPG, signature verification on GPG-signed packages to be turned on for all package repositories (package sources), or for individual repositories.
You can also use yum to set up your own repositories with RPM packages for download and installation on other machines. When possible, yum uses parallel download of multiple packages and metadata to speed up downloading.
You must have superuser privileges in order to use yum to install, update or remove packages on your system. All examples here assume that you have already obtained superuser privileges by using either the
2.3. Using yum for particular tasks
This section describes how to use yum to achieve particular tasks.
2.3.1. Checking for updates and updating packages
yum enables you to check if your system has any updates waiting to be applied. You can list packages that need to be updated and update them as a whole, or you can update a selected individual package.
220.127.116.11. Checking for updates
To see which installed packages on your system have updates available, use the following command:
The command shows the list of packages and their dependencies that have an update available. The output for each package consists of:
- the name of the package
- the CPU architecture the package was built for
- the version of the updated package to be installed
- the release of the updated package
- a build version, added as part of a z-stream update
- the repository in which the updated package is located.
18.104.22.168.1. Updating packages
You can choose to update a single package, multiple packages, or all packages at once. If any dependencies of the package or packages you update have updates available themselves, then they are updated too.
22.214.171.124.1.1. Updating a single package
To update a single package, run the following command as
yum always installs a new kernel regardless of whether you are using the
yum update or
yum install command to apply kernel updates.
When using RPM, on the other hand, it is important to use the
rpm -i kernel command which installs a new kernel instead of
rpm -u kernel which replaces the current kernel.
126.96.36.199.1.2. Updating a package group
To update a package group, type as
Here, replace group_name with a name of the package group you want to update. For more information on package groups, see Section 2.3.3, “Working with package groups”.
188.8.131.52.2. Updating all packages and their dependencies
To update all packages and their dependencies, use the
yum update command without any arguments:
184.108.40.206.3. Updating security-related packages
If packages have security updates available, you can update only these packages to their latest versions. Type as
You can also update packages only to versions containing the latest security updates. Type as
2.3.2. Working with packages
yum enables you to perform a complete set of operations with software packages, including searching for packages, viewing information about them, installing and removing.
220.127.116.11. Searching packages
You can search all package names, descriptions and summaries by using the following command:
Replace term with a package name you want to search.
yum search command is useful for searching for packages you do not know the name of, but for which you know a related term. Note that by default,
yum search returns matches in package name and summary, which makes the search faster. Use the
yum search --all command for a more exhaustive but slower search, which also includes package descriptions.
18.104.22.168.1. Filtering the Results
All of yum’s list commands allow you to filter the results by appending one or more glob expressions as arguments. Global expressions are normal strings of characters which contain one or more of the wildcard characters
* (which expands to match any character subset) and
? (which expands to match any single character).
Be careful to escape the global expressions when passing them as arguments to a
yum command, otherwise the Bash shell will interpret these expressions as pathname expansions, and potentially pass all files in the current directory that match the global expressions to
yum. To make sure the global expressions are passed to
yum as intended, use one of the following methods:
- escape the wildcard characters by preceding them with a backslash character
- double-quote or single-quote the entire global expression.
22.214.171.124. Listing packages
To list information on all installed and available packages type the following at a shell prompt:
To list installed and available packages that match inserted global expressions use the following command:
To list all packages installed on your system use the
To list all packages in all enabled repositories that are available to install, use the command in the following form:
126.96.36.199.1. Listing repositories
To list the repository ID, name, and number of packages for each enabled repository on your system, use the following command:
To list more information about these repositories, use the
repoinfo command. With this command, information including the file name, overall size, date of the last update, and base URL are displayed for each listed repository.
To list both enabled and disabled repositories use the following command. A status column is added to the output list to show which of the repositories are enabled.
disabled as a first argument, you can reduce the command output to disabled repositories. For further specification you can pass the ID or name of repositories or related glob_expressions as arguments. Note that if there is an exact match between the repository ID or name and the inserted argument, this repository is listed even if it does not pass the enabled or disabled filter.
188.8.131.52.2. Displaying package information
To display information about one or more packages, use the following command (global expressions are valid here as well):
Replace package_name with the name of the package.
184.108.40.206.3. Installing packages
To install a single package and all of its non-installed dependencies, enter a command in the following form as
You can also install multiple packages simultaneously by appending their names as arguments. To do so, type as
If you are installing packages on a multilib system, such as an AMD64 or Intel 64 machine, you can specify the architecture of the package (as long as it is available in an enabled repository) by appending .arch to the package name:
You can use global expressions to quickly install multiple similarly named packages. Execute as
In addition to package names and global expressions, you can also provide file names to
yum install. If you know the name of the binary you want to install, but not its package name, you can give
yum install the path name. As
Yum then searches through its package lists, finds the package which provides
/usr/sbin/named, if any, and prompts you as to whether you want to install it.
As you can see in the above examples, the
yum install command does not require strictly defined arguments. It can process various formats of package names and global expressions, which makes installation easier for users. On the other hand, it takes some time until yum parses the input correctly, especially if you specify a large number of packages. To optimize the package search, you can use the following commands to explicitly define how to parse the arguments:
install-n, yum interprets name as the exact name of the package. The
install-na command tells yum that the subsequent argument contains the package name and architecture divided by the dot character. With
install-nevra, yum will expect an argument in the form name-epoch:version-release.architecture. Similarly, you can use
yum remove-na, and
yum remove-nevra when searching for packages to be removed.
If you know you want to install the package that contains the
named binary, but you do not know in which
sbin/ directory the file is installed, use the
yum provides command with a global expression.
yum provides "*/file_name" is a useful way to find the packages that contain file_name.
To install a previously-downloaded package from a local directory on your system, use the following command:
Replace path with the path to the package you want to install.
Alternatively, you can use also the
yum localinstall command to install a previously -nloaded package from a local directory.
220.127.116.11.4. Removing packages
To uninstall a particular package, as well as any packages that depend on it, run the following command as
To remove multiple packages at once by adding more package names to the command.
remove can take these arguments:
- package names
- global expressions
- file lists
- package provides
yum is not able to remove a package without also removing packages which depend on it.
2.3.3. Working with package groups
A package group is a collection of packages that serve a common purpose, for instance System Tools or Sound and Video. Installing a package group pulls a set of dependent packages, saving time considerably. The
yum groups command is a top-level command that covers all the operations that act on package groups in yum.
18.104.22.168. Listing package groups
summary option is used to view the number of:
- installed groups
- available groups
- available environment groups
- installed and available language groups
To list all package groups from yum repositories add the
list option. You can filter the command output by group names.
Several optional arguments can be passed to this command, including
--hidden to list also groups not marked as user visible, and
-v to list group IDs. You can also add
--available options to reduce the command output to a specific group type.
To list mandatory and optional packages contained in a particular group, use the following command:
A package group can be marked with @. When using
remove, pass @group_name to specify a package group or an environmental group.
22.214.171.124. Installing a package group
You can install a package group by passing its full group name, without the groupid part, to the
group install command. As
You can also install by groupid. As
root, execute the following command:
You can pass the groupid or quoted group name to the
install command if you prepend it with an @ symbol, which tells
yum that you want to perform
group install. As
Replace group with the groupid or quoted group name. The same logic appplies to environmental groups:
126.96.36.199. Removing a package group
You can remove a package group using syntax similar to the
install syntax, with use of either name of the package group or its id. As
Also, you can pass the groupid or quoted name to the
remove command if you prepend it with an @ symbol, which tells yum that you want to perform
group remove. As
Replace group with the groupid or quoted group name. Similarly, you can replace an environmental group:
2.4. Working with transaction history
yum history command enables users to review information about a timeline of yum transactions, the dates and times they occurred, the number of packages affected, whether these transactions succeeded or were aborted, and if the RPM database was changed between transactions. Additionally, this command can be used to undo or redo certain transactions.
2.4.1. Listing transactions
To display a list of the twenty most recent transactions, as
root, either run
yum history with no additional arguments, or type the following at a shell prompt:
To examine a particular transaction or transactions in more detail, run the following command as
The id argument here stands for the ID of the transaction. This argument is optional and when you omit it, yum automatically uses the last transaction.
2.4.2. Reverting and repeating transactions
Apart from reviewing the transaction history, the
yum history command provides means to revert or repeat a selected transaction. To revert a transaction, type the following at a shell prompt as
To repeat a particular transaction, as
root, run the following command:
Both commands also accept the
last keyword to undo or repeat the latest transaction.
Note that both
yum history undo and
yum history redo commands only revert or repeat the steps that were performed during a transaction. If the transaction installed a new package, the
yum history undo command will uninstall it, and if the transaction uninstalled a package the command will again install it. This command also attempts to downgrade all updated packages to their previous version, if these older packages are still available.
2.5. Configuring yum and yum repositories
The configuration information for yum and related utilities is located in the
/etc/yum.conf file. This file contains one mandatory
[main] section, which enables you to set yum options that have global effect, and can also contain one or more
[repository] sections, which allow you to set repository-specific options. However, it is recommended to define individual repositories in new or existing
.repo files in the
/etc/yum.repos.d/ directory. The values you define in individual
[repository] sections of the
/etc/yum.conf file override values set in the
This section shows how to:
set global yum options by editing the
[main]section of the
set options for individual repositories by editing the
.repofiles in the
- add, enable, and disable yum repositories on the command line
2.5.1. Viewing the current configuration
To display the current values of global yum options (that is, the options specified in the
[main] section of the
/etc/yum.conf file), follow this procedure:
yum-utilspackage must be installed on the system. To make sure that
yum-utilsis installed, type the following at a shell prompt as
yum install yum-utils
To display the current values of global yum options, execute the
yum-config-managercommand with the following command-line option:
yum config-manager --dump
2.5.2. Setting [main] options
/etc/yum.conf configuration file contains exactly one
[main] section, and while some of the key-value pairs in this section affect how yum operates, others affect how yum treats repositories.
You can add many additional options under the
[main] section heading in
For a complete list of available
[main] options, see the
[main] OPTIONS section of the yum.conf(5) manual page.
2.5.3. Setting [repository] options
[repository] sections, where repository is a unique repository ID such as
my_personal_repo (spaces are not permitted), allow you to define individual yum repositories. To avoid conflicts, do not use names used by Red Hat repositories for custom repositories.
For a complete list of available
[repository] options, see the
[repository] OPTIONS section of the yum.conf(5) manual page.
2.5.4. Adding, enabling, and disabling a yum repository
Section 2.5.3, “Setting [repository] options” describes various options you can use to define a yum repository. This section explains how to add, enable, and disable a repository by using the
188.8.131.52. Adding a yum repository
To define a new repository, you can either add a
[repository] section to the
/etc/yum.conf file, or to a
.repo file in the
/etc/yum.repos.d/ directory. All files with the
.repo file extension in this directory are read by yum, and it is recommended to define your repositories here instead of in
Obtaining and installing software packages from unverified or untrusted software sources other than Red Hat’s certificate-based
Content Delivery Network (CDN) constitutes a potential security risk, and could lead to security, stability, compatibility, and maintainability issues.
Yum repositories commonly provide their own
.repo file. To add such a repository to your system and enable it, run the following command as
Here repository_url is a link to the
184.108.40.206. Enabling a yum repository
To enable a particular repository or repositories, type the following at a shell prompt as
Here repository is the unique repository ID (use
yum repolist all to list available repository IDs).
Disabling a yum repository
To disable a yum repository, run the following command as
Here repository is the unique repository ID (use
yum repolist all to list available repository IDs).
2.6. Using yum plug-ins
Yum provides plug-ins that extend and enhance its operations. Certain plug-ins are installed by default. Yum always informs you which plug-ins, if any, are loaded and active whenever you call any
2.6.1. Enabling, configuring, and disabling yum plug-ins
To enable yum plug-ins, ensure that a line beginning with
plugins= is present in the
[main] section of
/etc/yum.conf, and that its value is
You can disable all plug-ins by changing this line to
Disabling all plug-ins is not advised because certain plug-ins provide important yum services. In particular, the product-id and subscription-manager plug-ins provide support for the certificate-based
Content Delivery Network (CDN). Disabling plug-ins globally is provided as a convenience option, and is generally only recommended when diagnosing a potential problem with yum.
Every installed plug-in has its own configuration file in the
/etc/dnf/plugins/ directory. You can set plug-in specific options in these files.
Similar to the
/etc/yum.conf file, the plug-in configuration files always contain a
[main] section where the
enabled= option controls whether the plug-in is enabled when you run
yum commands. If this option is missing, you can add it manually to the file.
If you disable all plug-ins by setting
/etc/yum.conf, then all plug-ins are disabled regardless of whether they are enabled in their individual configuration files.
If you want to disable all yum plug-ins for a single
yum command, use the
If you want to disable one or more yum plug-ins for a single
yum command, add the
--disableplugin=plugin_name option to the command.
2.7. Automatically refreshing package database and dowloading updates
To check and download package updates automatically and regularly, you can use the DNF Automatic tool that is provided by the
DNF Automatic is an alternative command-line interface to YUM that is suited for automatic and regular execution using systemd timers, cron jobs and other such tools.
DNF Automatic synchronizes package metadata as needed and then checks for updates available. After, the tool can perfom one of the following actions depending on how you configure it:
- Download updated packages
- Download and apply the updates
The outcome of the operation is then reported by a selected mechanism, such as the standard output or email.
2.7.1. How DNF Automatic operates
The behavior of DNF Automatic is defined by its configuration file, which is by default the
To run DNF Automatic, you always need to enable and start a specific systemd timer unit. You can use one of the timer units provided in the
dnf-automatic package, or you can write your own timer unit depending on your needs.
dnf-automatic package includes the following systemd timer units:
This timer unit behaves as the configuration file specifies with regards to downloading and applying updates.
The timer units below override the configuration file with regards to downloading and applying updates.
Regardless of the configuration file settings, this timer unit only notifies you about available updates.
Regardless of the configuration file settings, this timer unit only downloads available updates, but does not install these updates.
Regardless of the configuration file settings, this timer downloads and installs available updates.
2.7.2. DNF Automatic configuration file
By default, DNF Automatic uses
/etc/dnf/automatic.conf as its configuration file to define its behavior.
The configuration file is separated into the following topical sections:
Sets the mode of operation of DNF Automatic.
Defines how the results of DNF Automatic are reported.
Provides the email emitter configuration for an external command used to send email.
Provides the email emitter configuration.
Overrides settings from YUM’s main configuration file.
Settings of the operation mode from the
[commands] section are overridden by settings used by a systemd timer unit for all timer units except
For more details on particular sections, see DNF Automatic documentation.
With the default settings of
/etc/dnf/automatic.conf, DNF Automatic checks for available updates, downloads them, and reports the results as standard output.
2.7.3. Running DNF Automatic
To run DNF Automatic:
/etc/dnf/automatic.confconfiguration file for any specific behaviors.
For more information on DNF Automatic configuration file, see Section 2.7.2, “DNF Automatic configuration file”.
Enable and start the systemd timer unit that most closely fits your needs.
For reporting about available updates:
systemctl enable dnf-automatic-notifyonly.timer
systemctl start dnf-automatic-notifyonly.timer
For downloading available updates:
systemctl enable dnf-automatic-download.timer
systemctl start dnf-automatic-download.timer
For downloading and installing available updates:
systemctl enable dnf-automatic-install.timer
systemctl start dnf-automatic-install.timer
Alternatively, you can also run DNF Automatic by executing the
/usr/bin/dnf-automatic file directly from the command line or from a custom script.
2.8. Additional resources
The following sources of information provide additional resources regarding YUM.
2.8.1. Installed Documentation
yum(8) — The manual page for the
yumcommand-line utility provides a complete list of supported options and commands.
yum.conf(5) — The manual page named
yum.confdocuments available yum configuration options.
2.8.2. Online Documentation
- Red Hat Customer Portal Labs — The Red Hat Customer Portal Labs includes a "Yum Repository Configuration Helper".