Red Hat Enterprise Linux-9-Managing Software With The DNF tool-en-US
Red Hat Enterprise Linux-9-Managing Software With The DNF tool-en-US
Managing content in the RPM repositories by using the DNF software management
tool
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons
Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is
available at
http://creativecommons.org/licenses/by-sa/3.0/
. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must
provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift,
Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States
and other countries.
Linux ® is the registered trademark of Linus Torvalds in the United States and other countries.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and
other countries.
Node.js ® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the
official Joyent Node.js open source or commercial project.
The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks
or trademarks/service marks of the OpenStack Foundation, in the United States and other
countries and are used with the OpenStack Foundation's permission. We are not affiliated with,
endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
Abstract
Find, install, and utilize content distributed through the RPM repositories by using the DNF tool.
Learn how to work with packages, modules, streams, and profiles.
Table of Contents
Table of Contents
. . . . . . . . . .OPEN
MAKING . . . . . . SOURCE
. . . . . . . . . .MORE
. . . . . . .INCLUSIVE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4. . . . . . . . . . . . .
. . . . . . . . . . . . . FEEDBACK
PROVIDING . . . . . . . . . . . . ON
. . . .RED
. . . . .HAT
. . . . .DOCUMENTATION
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5. . . . . . . . . . . . .
. . . . . . . . . . . 1.. .SOFTWARE
CHAPTER . . . . . . . . . . . . MANAGEMENT
. . . . . . . . . . . . . . . . .TOOLS
. . . . . . . .IN
. . RED
. . . . . HAT
. . . . . ENTERPRISE
. . . . . . . . . . . . . .LINUX
. . . . . . . 9. . . . . . . . . . . . . . . . . . . . . . . . . . 6. . . . . . . . . . . . .
.CHAPTER
. . . . . . . . . . 2.
. . DISTRIBUTION
. . . . . . . . . . . . . . . . OF
. . . .CONTENT
. . . . . . . . . . .IN
. . RHEL
. . . . . . .9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7. . . . . . . . . . . . .
2.1. REPOSITORIES 7
2.2. APPLICATION STREAMS 7
2.3. MODULES 8
2.4. MODULE STREAMS 8
2.5. MODULE PROFILES 9
. . . . . . . . . . . 3.
CHAPTER . . CONFIGURING
. . . . . . . . . . . . . . . . DNF
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
..............
3.1. VIEWING THE CURRENT DNF CONFIGURATIONS 10
3.2. SETTING DNF MAIN OPTIONS 10
3.3. MANAGING DNF PLUG-INS 10
3.4. ENABLING AND DISABLING DNF PLUG-INS 10
.CHAPTER
. . . . . . . . . . 4.
. . .SEARCHING
. . . . . . . . . . . . .FOR
. . . . .RHEL
. . . . . .9. .CONTENT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
..............
4.1. SEARCHING FOR SOFTWARE PACKAGES 12
4.2. LISTING SOFTWARE PACKAGES 12
4.3. LISTING REPOSITORIES 13
4.4. DISPLAYING PACKAGE INFORMATION 13
4.5. LISTING PACKAGE GROUPS AND PACKAGES THEY PROVIDE 14
4.6. LISTING AVAILABLE MODULES AND THEIR CONTENTS 15
4.7. SPECIFYING GLOBAL EXPRESSIONS IN DNF INPUT 16
4.8. ADDITIONAL RESOURCES 17
.CHAPTER
. . . . . . . . . . 5.
. . INSTALLING
. . . . . . . . . . . . . .RHEL
. . . . . . 9. .CONTENT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
..............
5.1. INSTALLING PACKAGES 18
5.2. INSTALLING PACKAGE GROUPS 18
5.3. INSTALLING MODULAR CONTENT 19
5.4. DEFINING CUSTOM DEFAULT MODULE STREAMS AND PROFILES 20
5.5. ADDITIONAL RESOURCES 21
. . . . . . . . . . . 6.
CHAPTER . . .UPDATING
. . . . . . . . . . . RHEL
. . . . . . .9. CONTENT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
..............
6.1. CHECKING FOR UPDATES 22
6.2. UPDATING PACKAGES 22
6.3. UPDATING SECURITY-RELATED PACKAGES 23
.CHAPTER
. . . . . . . . . . 7.
. . AUTOMATING
. . . . . . . . . . . . . . . .SOFTWARE
. . . . . . . . . . . . UPDATES
. . . . . . . . . . .IN
. . .RHEL
. . . . . .9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
..............
7.1. INSTALLING DNF AUTOMATIC 24
7.2. DNF AUTOMATIC CONFIGURATION FILE 24
7.3. ENABLING DNF AUTOMATIC 25
7.4. OVERVIEW OF THE SYSTEMD TIMER UNITS INCLUDED IN THE DNF-AUTOMATIC PACKAGE 26
.CHAPTER
. . . . . . . . . . 8.
. . .REMOVING
. . . . . . . . . . . .RHEL
. . . . . .9. .CONTENT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28
..............
8.1. REMOVING INSTALLED PACKAGES 28
8.2. REMOVING PACKAGE GROUPS 28
8.3. REMOVING INSTALLED MODULAR CONTENT 28
8.3.1. Removing packages from an installed profile 28
8.3.2. Removing all packages from a module stream 30
8.4. ADDITIONAL RESOURCES 32
1
Red Hat Enterprise Linux 9 Managing software with the DNF tool
.CHAPTER
. . . . . . . . . . 9.
. . .HANDLING
. . . . . . . . . . . .PACKAGE
. . . . . . . . . . .MANAGEMENT
. . . . . . . . . . . . . . . .HISTORY
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
..............
9.1. LISTING TRANSACTIONS 33
9.2. REVERTING DNF TRANSACTIONS 34
9.2.1. Reverting a single DNF transaction 34
9.2.2. Reverting multiple DNF transactions 35
.CHAPTER
. . . . . . . . . . 10.
. . . MANAGING
. . . . . . . . . . . . .CUSTOM
. . . . . . . . . .SOFTWARE
. . . . . . . . . . . . REPOSITORIES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
..............
10.1. DNF REPOSITORY OPTIONS 36
10.2. ADDING A DNF REPOSITORY 36
10.3. ENABLING A DNF REPOSITORY 37
10.4. DISABLING A DNF REPOSITORY 37
.CHAPTER
. . . . . . . . . . 11.
. . .MANAGING
. . . . . . . . . . . . VERSIONS
. . . . . . . . . . . .OF
. . . APPLICATION
. . . . . . . . . . . . . . . STREAM
. . . . . . . . . .CONTENT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38
..............
11.1. MODULAR DEPENDENCIES AND STREAM CHANGES 38
11.2. INTERACTION OF MODULAR AND NON-MODULAR DEPENDENCIES 38
11.3. RESETTING MODULE STREAMS 38
11.4. DISABLING ALL STREAMS OF A MODULE 39
11.5. SWITCHING TO A LATER STREAM 39
.APPENDIX
. . . . . . . . . . .A.
. . DNF
. . . . . .COMMANDS
. . . . . . . . . . . . . LIST
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
..............
A.1. COMMANDS FOR LISTING CONTENT IN RHEL 9 41
A.2. COMMANDS FOR INSTALLING CONTENT IN RHEL 9 42
A.3. COMMANDS FOR REMOVING CONTENT IN RHEL 9 43
2
Table of Contents
3
Red Hat Enterprise Linux 9 Managing software with the DNF tool
4
PROVIDING FEEDBACK ON RED HAT DOCUMENTATION
4. Enter your suggestion for improvement in the Description field. Include links to the relevant
parts of the documentation.
5
Red Hat Enterprise Linux 9 Managing software with the DNF tool
NOTE
Although RHEL 8 and RHEL 9 are based on DNF, they are compatible with YUM used in
RHEL 7.
6
CHAPTER 2. DISTRIBUTION OF CONTENT IN RHEL 9
2.1. REPOSITORIES
Red Hat Enterprise Linux (RHEL) distributes content through different repositories, for example:
BaseOS
Content in the BaseOS repository consists of the core set of the underlying operating system
functionality that provides the foundation for all installations. This content is available in the RPM
format and is subject to support terms similar to those in earlier releases of RHEL.
AppStream
Content in the AppStream repository includes additional user-space applications, runtime
languages, and databases in support of the varied workloads and use cases.
IMPORTANT
Both the BaseOS and AppStream content sets are required by RHEL and are available in
all RHEL subscriptions.
Additional resources
Package manifest
RPM format
Software Collections
RHEL 9 improves Application Streams experience by providing initial Application Stream versions as
RPMs, which you can install by using the dnf install command.
Starting with RHEL 9.1, Red Hat provides additional Application Stream versions as modules with a
shorter life cycle.
IMPORTANT
7
Red Hat Enterprise Linux 9 Managing software with the DNF tool
IMPORTANT
Each Application Stream has its own life cycle, and it can be the same or shorter than the
life cycle of RHEL 9. See Red Hat Enterprise Linux Application Streams Life Cycle .
Always determine which version of an Application Stream you want to install, and make
sure to review the RHEL Application Stream life cycle first.
Additional resources
Package manifest
2.3. MODULES
A module is a set of RPM packages that represent a component. A typical module contains the following
package types:
Module streams can be active or inactive. Active streams give the system access to the RPM packages
within the particular module stream, allowing the installation of the respective component version.
If the stream is the default stream. Each module can have a default stream but in Red Hat
Enterprise Linux 9, no default streams are defined. If required, you can configure default
streams as described in Defining custom default module streams and profiles .
Only one stream of a particular module can be active at a given point in time. Therefore, only packages
from a particular stream are available.
Prior to selecting a particular stream for a runtime user application or a developer application, consider
the following:
8
CHAPTER 2. DISTRIBUTION OF CONTENT IN RHEL 9
The life cycle of the Application Stream and your update plan
For a list of all available modules and streams, see the Package manifest. For per-component changes,
see the Release Notes.
Additional resources
Installing packages by using a profile is a one-time action provided for the user’s convenience. It is also
possible to install packages by using multiple profiles of the same module stream without any further
preparatory steps.
Each module stream can have any number of profiles, including none. For any given module stream,
some of its profiles can be marked as default and are then used for profile installation actions if you did
not explicitly specify a profile. However, the existence of a default profile for a module stream is not
required.
The nodejs module, which provides the Node.js runtime environment, offers the following profiles
for installation:
minimal: The smallest set of packages that provides the Node.js runtime environment.
s2i: Packages necessary for creating Node.js Source-to-Image (S2I) Linux containers.
9
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Procedure
Additional resources
Procedure
Additional resources
The [main] OPTIONS and OPTIONS FOR BOTH [main] AND REPO sections in the
dnf.conf(5) man page.
[main]
enabled=False
10
CHAPTER 3. CONFIGURING DNF
WARNING
Disable all plug-ins only for diagnosing a potential problem. DNF requires certain
plug-ins, such as product-id and subscription-manager, and disabling them
causes Red Hat Enterprise Linux to not be able to install or update software from
the Content Delivery Network (CDN).
Procedure
Use one of the following methods to influence how DNF uses plug-ins:
To enable or disable loading of DNF plug-ins globally, add the plugins parameter to the
[main] section of the /etc/dnf/dnf.conf file.
To disable all DNF plug-ins for a particular command, append the --noplugins option to the
command. For example, to disable DNF plug-ins for a single update command, enter:
To disable certain DNF plug-ins for a single command, append the --disableplugin=plugin-
name option to the command. For example, to disable a certain DNF plug-in for a single
update command, enter:
To enable certain DNF plug-ins for a single command, append the --enableplugin=plugin-
name option to the command. For example, to enable a certain DNF plug-in for a single
update command, enter:
11
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Procedure
Depending on your scenario, use one of the following options to search the repository:
Note that searching additionally in the description by using the --all option is slower than a
normal search operation.
To search for a package name and list the package name and its version in the output,
enter:
To search for which package provides a file, specify the file name or the path to the file:
Procedure
List the latest versions of all available packages, including architectures, version numbers, and
the repository they where installed from:
The @ sign in front of a repository indicates that the package in this line is currently installed.
12
CHAPTER 4. SEARCHING FOR RHEL 9 CONTENT
Alternatively, to display all available packages, including version numbers and architectures,
enter:
$ dnf repoquery
...
zlib-0:1.2.11-35.el9_1.i686
zlib-0:1.2.11-35.el9_1.x86_64
zlib-0:1.2.11-39.el9.i686
zlib-0:1.2.11-39.el9.x86_64
zlib-devel-0:1.2.11-39.el9.i686
zlib-devel-0:1.2.11-39.el9.x86_64
...
Optionally, you can filter the output by using other options instead of --all, for example:
Use --upgrades to list packages for which newer versions are available.
NOTE
You can filter the results by appending global expressions as arguments. For
more details, see Specifying global expressions in DNF input .
Procedure
$ dnf repolist
To display only certain repositories, append one of the following options to the command:
NOTE
You can filter the results by using global expressions. For details, see Specifying
global expressions in DNF input.
13
Red Hat Enterprise Linux 9 Managing software with the DNF tool
You can query DNF repositories to display further details about a package, such as the following:
Version
Release
Architecture
Package size
Description
Procedure
This command displays the information for the currently installed package and, if available, its
newer versions that are in the repository. Alternatively, use the following command to display
the information for all packages with the specified name in the repository:
NOTE
You can filter the results by appending global expressions as arguments. For
details, see Specifying global expressions in DNF input .
Procedure
Note that you can filter the results by appending the --installed and --available option to the
dnf group list command. By using the --hidden option, you can display hidden groups in the
output.
NOTE
You can filter the results by appending global expressions as arguments. For
more details, see Specifying global expressions in DNF input .
14
CHAPTER 4. SEARCHING FOR RHEL 9 CONTENT
Procedure
Use the dnf module list <module_name> command to list the same information but only
for a specific module.
For example, to display which module and profiles provide the npm package, enter:
List all details about a module, including a description, list of all profiles, and a list of all
packages the module provides:
15
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Architecture : x86_64
Profiles : common [d], development, minimal, s2i
Default profiles : common
Repo : rhel-9-for-x86_64-appstream-rpms
Summary : Javascript runtime
Description : Node.js is a platform built on Chrome's JavaScript runtime...
Requires : platform:[el9]
Artifacts : nodejs-1:18.10.0-3.module+el9.1.0+16866+0fab0697.src
: nodejs-1:18.10.0-3.module+el9.1.0+16866+0fab0697.x86_64
: npm-1:8.19.2-1.18.10.0.3.module+el9.1.0+16866+0fab0697.x86_64
...
For example, to display this information for the nodejs module, enter:
Additional resources
Modules
Module streams
Module profiles
Procedure
Use one of the following methods if you use global expressions in dnf commands:
Note that you must precede <file_name> either by / for an absolute path or */ to use a
wildcard if the full path is unknown.
16
CHAPTER 4. SEARCHING FOR RHEL 9 CONTENT
Escape the wildcard characters by preceding them with a backslash (\) character:
17
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Prerequisites
Optional: You know the name of the package you want to install .
If the package you want to install is provided by a module stream, the respective module stream
is enabled.
Procedure
If you install packages on a system that supports multiple architectures, such as i686 and
x86_64, you can specify the architecture of the package by appending it to the package
name:
To install a package if you only know the path to the file the package provides but not the
package name, you can use this path to install the corresponding package:
If the package has dependencies, specify the paths to these RPM files as well. Otherwise,
DNF downloads the dependencies from the repositories or fails if they are not available in
the repositories.
Additional resources
18
CHAPTER 5. INSTALLING RHEL 9 CONTENT
Prerequisites
Procedure
Procedure
For example, to list the details about the nodejs module, enter:
2. Install a module:
If a default profile for a stream is defined, you can omit /<profile> in the command to install this
default profile of the stream.
NOTE
For example, to install the default profile (common) from stream 18 of the nodejs module,
enter:
19
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Verification
Verify that the correct module stream is enabled ([e]) and the required profile was installed ( [i]):
Additional resources
Modules
Module streams
Module profiles
Procedure
1. Use the dnf module list <module_name> command to display the available streams and their
profiles, for example:
In this example, nodejs:18 is not set as the default stream, and the default profile in this stream
is common.
2. Create a YAML file in the /etc/dnf/modules.defaults.d/ directory to define the default stream
and profile for a module.
20
CHAPTER 5. INSTALLING RHEL 9 CONTENT
document: modulemd-defaults
version: 1
data:
module: nodejs
stream: "18"
profiles:
'18': [minimal]
Verification
Use the dnf module list <module_name> command to verify the new default stream and
profile settings, for example:
Additional resources
Modules
Module streams
Module profiles
21
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Procedure
# dnf check-update
The output returns the list of packages and their dependencies that have an update available.
IMPORTANT
When applying updates to the kernel, dnf always installs a new kernel regardless of
whether you are using the dnf upgrade or dnf install command. Note that this only
applies to packages identified by using the installonlypkgs DNF configuration option.
Such packages include, for example, the kernel, kernel-core, and kernel-modules
packages.
Procedure
Depending on your scenario, use one of the following options to apply updates:
# dnf upgrade
IMPORTANT
If you upgraded the GRUB boot loader packages on a BIOS or IBM Power system,
reinstall GRUB. See Reinstalling GRUB.
22
CHAPTER 6. UPDATING RHEL 9 CONTENT
Procedure
Depending on your scenario, use one of the following options to apply updates:
To upgrade to the latest available packages that have security errata, enter:
IMPORTANT
If you upgraded the GRUB boot loader packages on a BIOS or IBM Power system,
reinstall GRUB. See Reinstalling GRUB.
Additional resources
23
Red Hat Enterprise Linux 9 Managing software with the DNF tool
DNF Automatic synchronizes package metadata as needed, checks for updates available, and then
performs one of the following actions depending on how you configure the tool:
Exit
The outcome of the operation is then reported by a selected mechanism, such as the standard output or
email.
Procedure
Verification
Verify the successful installation by confirming the presence of the dnf-automatic package:
[commands]
Sets the mode of operation of DNF Automatic.
WARNING
24
CHAPTER 7. AUTOMATING SOFTWARE UPDATES IN RHEL 9
[emitters]
Defines how the results of DNF Automatic are reported.
[command]
Defines the command emitter configuration.
[command_email]
Provides the email emitter configuration for an external command used to send email.
[email]
Provides the email emitter configuration.
[base]
Overrides settings from the main configuration file of DNF.
With the default settings of the /etc/dnf/automatic.conf file, DNF Automatic checks for available
updates, downloads them, and reports the results to standard output.
Additional resources
Prerequisites
Procedure
If you want to only enable the timer without executing it immediately, omit the --now option.
Verification
25
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Optional: Check when each of the timers on your system ran the last time:
Additional resources
For example if you set download_updates = yes in the /etc/dnf/automatic.conf configuration file, but
you have activated the dnf-automatic-notifyonly.timer unit, the packages will not be downloaded.
26
CHAPTER 7. AUTOMATING SOFTWARE UPDATES IN RHEL 9
27
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Procedure
Procedure
IMPORTANT
DNF tries to remove all packages with a name corresponding to the packages installed
with a profile or a stream, including their dependent packages. Always check the list of
packages to be removed before you proceed, especially if you have enabled custom
repositories on your system.
To remove all packages from a selected stream, complete the steps in Removing all packages from a
module stream.
Prerequisites
The selected profile is installed by using the dnf module install <module-
name:stream/profile> command or as a default profile by using the dnf install <module-
name:stream command>.
28
CHAPTER 8. REMOVING RHEL 9 CONTENT
Procedure
For example, to remove packages and their dependencies from the development profile of the
nodejs:18 module stream, enter:
Removing:
nodejs-devel x86_64 1:18.7.0-1.module+el9.1.0+16284+4fdefb2f
@rhel-AppStream 950 k
Removing unused dependencies:
brotli x86_64 1.0.9-6.el9
@rhel-AppStream 754 k
brotli-devel x86_64 1.0.9-6.el9
@rhel-AppStream 55 k
...
Disabling module profiles:
nodejs/development
Transaction Summary
========================================================================
Remove 26 Packages
WARNING
NOTE
29
Red Hat Enterprise Linux 9 Managing software with the DNF tool
NOTE
These operations will not remove packages from the stream that do not belong
to any of the profiles.
Verification
Additional resources
To remove only packages from a selected profile, complete the steps in Removing packages from an
installed profile.
Prerequisites
The module stream is enabled and at least some packages from the stream have been installed.
Procedure
For example, to remove all packages from the nodejs:18 module stream, enter:
30
CHAPTER 8. REMOVING RHEL 9 CONTENT
========
Package Architecture Version
Repository Size
===========================================================================
========
Removing:
nodejs x86_64 1:18.10.0-3.module+el9.1.0+16866+0fab0697
@rhel-AppStream 43 M
nodejs-devel x86_64 1:18.10.0-3.module+el9.1.0+16866+0fab0697
@rhel-AppStream 953 k
nodejs-docs noarch 1:18.10.0-3.module+el9.1.0+16866+0fab0697
@rhel-AppStream 78 M
nodejs-full-i18n x86_64 1:18.10.0-3.module+el9.1.0+16866+0fab0697
@rhel-AppStream 29 M
nodejs-nodemon noarch 2.0.15-1.module+el9.1.0+15718+e52ec601
@rhel-AppStream 2.0 M
nodejs-packaging noarch 2021.06-4.module+el9.1.0+15718+e52ec601
@rhel-AppStream 41 k
npm x86_64 1:8.19.2-1.18.10.0.3.module+el9.1.0+16866+0fab0697
@rhel-AppStream 6.9 M
Removing unused dependencies:
brotli x86_64 1.0.9-6.el9
@rhel-AppStream 754 k
brotli-devel x86_64 1.0.9-6.el9
@rhel-AppStream 55 k
...
Disabling module profiles:
nodejs/common
nodejs/development
nodejs/minimal
nodejs/s2i
Transaction Summary
===========================================================================
========
Remove 31 Packages
WARNING
2. Optional: Reset or disable the stream by entering one of the following commands:
31
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Verification
Verify that all packages from the selected module stream were removed:
Additional resources
32
CHAPTER 9. HANDLING PACKAGE MANAGEMENT HISTORY
You can also use the dnf history command to undo the transactions.
Procedure
Depending on your scenario, use one of the following options to display transaction information:
# dnf history
The Action(s) column displays which type of action was performed during a transaction,
for example, Install (I), Upgrade (U), Remove ( E), and other actions.
The Altered column displays the number of actions performed during the transaction.
The number of actions can also be followed by the result of the transaction.
For more information about the values of the Action(s) and Altered columns, see the
dnf(8) man page.
To display a list of all the latest operations for a selected package, enter:
NOTE
33
Red Hat Enterprise Linux 9 Managing software with the DNF tool
NOTE
You can filter the results by appending global expressions as arguments. For more details,
see Specifying global expressions in dnf input .
Additional resources
Revert a single DNF transaction by using the dnf history undo command.
Revert all DNF transactions performed between the specified transaction and the last
transaction by using the dnf history rollback command.
IMPORTANT
Downgrading RHEL system packages to an older version by using the dnf history undo
and dnf history rollback command is not supported. This concerns especially the
selinux, selinux-policy-*, kernel, and glibc packages, and dependencies of glibc such as
gcc. Therefore, downgrading a system to a minor version (for example, from RHEL 9.1 to
RHEL 9.0) is not recommended because it might leave the system in an incorrect state.
If the transaction installed a new package, dnf history undo uninstalls the package.
If the transaction uninstalled a package, dnf history undo reinstalls the package.
The dnf history undo command also attempts to downgrade all updated packages to their
previous versions if the older packages are still available.
NOTE
If an older package version is not available, the downgrade by using the dnf
history undo command fails.
Procedure
# dnf history
ID | Command line | Date and time | Action(s) | Altered
--------------------------------------------------------------------
34
CHAPTER 9. HANDLING PACKAGE MANAGEMENT HISTORY
2. Optional: Verify that this is the transaction you want to revert by displaying its details:
For example, if you want to uninstall the previously installed unzip package, enter:
Procedure
# dnf history
ID | Command line | Date and time | Action(s) | Altered
------------------------------------------------------------------
14 | install wget | 2022-11-03 10:49 | Install | 1
13 | install unzip | 2022-11-03 10:49 | Install | 1
12 | install vim-X11 | 2022-11-03 10:20 | Install | 171 EE
For example, to revert to the state before the wget and unzip packages were installed, enter:
Alternatively, to revert all transactions in the transaction history, use the transaction ID 1:
35
Red Hat Enterprise Linux 9 Managing software with the DNF tool
IMPORTANT
The /etc/dnf/dnf.conf file contains the [main] section and can contain one or more repository sections
([<repository-ID>]) that you can use to set repository-specific options. The values you define in
individual repository sections of the /etc/dnf/dnf.conf file override values set in the [main] section.
IMPORTANT
For a complete list of available repository ID options, see the [<repository-ID>] OPTIONS section of
the dnf.conf(5) man page.
Procedure
2. Review and, optionally, update the repository settings that the previous command has created
in the /etc/yum.repos.d/<repository_URL>.repo file:
# cat /etc/yum.repos.d/<repository_URL>.repo
36
CHAPTER 10. MANAGING CUSTOM SOFTWARE REPOSITORIES
WARNING
Procedure
Enable a repository:
Procedure
Disable a repository:
37
Red Hat Enterprise Linux 9 Managing software with the DNF tool
After any operations with packages or modules, the whole dependency tree of all underlying installed
packages must satisfy all the conditions that the packages declare. Additionally, all module stream
dependencies must be satisfied. For example, disabling a module stream can require disabling other
module streams. No packages will be removed automatically.
Note that the following actions can cause subsequent automatic operations:
Installing a module stream profile or installing packages from a stream can result in enabling
further module streams and installing further packages.
Removing a package can result in removing further packages. If these packages were provided
by modules, the module streams remain enabled in preparation for further installation, even if
no packages from these streams are installed any more. This mirrors the behavior of an unused
DNF repository.
The system will always retain the module and stream choices, unless explicitly instructed to change
them. A modular package will receive updates contained in the currently enabled stream of the module
that provides this package, but will not upgrade to a version contained in a different stream.
Resetting the module is useful, for example, if you want to only extract the RPM content from the
module without keeping the module enabled. You can use the dnf module reset command after
enabling the module and extracting its contents to reset this module to its initial state.
38
CHAPTER 11. MANAGING VERSIONS OF APPLICATION STREAM CONTENT
Procedure
The module is returned to the initial state. Information about an enabled stream and installed
profiles is erased but no installed content is removed.
Prerequisites
Procedure
The dnf command asks for confirmation and then disables the module with all its streams. All of
the module streams become inactive. No installed content is removed.
IMPORTANT
Back up your data and follow migration instructions specific to the component.
Prerequisites
Procedure
1. Switch the installed component to the new version and select the module (component) and
stream (version):
For example, to switch from the nodejs:18 module stream to the nodejs:20 stream, enter:
39
Red Hat Enterprise Linux 9 Managing software with the DNF tool
You can also switch from non-modular content to a module stream. For example, to switch from
non-modular PHP 8.0 to modular PHP 8.1, enter:
2. Optional: Switch the installed component to the new version and select also the profile to be
installed or updated:
Verification
Verify that the installed component was switched to the new version ([e]):
40
APPENDIX A. DNF COMMANDS LIST
Command Description
dnf search term Search for a package by using term related to the
package.
dnf repoquery package Search for enabled DNF repositories for a selected
package and its version.
dnf list --available List all packages in all enabled repositories that are
available to install.
dnf repoquery
dnf repoquery --info --installed Display details of a package installed on your system.
package_name
41
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Command Description
dnf module info --profile module_name Display packages associated with available profiles of
a selected module.
dnf module info --profile Display packages associated with available profiles of
module_name:stream a module by using a specified stream.
dnf module provides package Determine which modules, streams, and profiles
provide a package.
dnf group summary View the number of installed and available groups.
dnf group info group_name List mandatory and optional packages included in a
particular group.
Command Description
dnf install /usr/sbin/binary_file Install a binary by using the path to the binary as an
argument.
42
APPENDIX A. DNF COMMANDS LIST
Command Description
dnf module install module_name:stream Install a default profile from a specific module
stream.
dnf install @module_name:stream
Note that running this command also enables the
specified stream.
Command Description
dnf group remove group_name Remove a package group by the group name.
dnf module remove --all Remove all packages from the specified stream.
module_name:stream
Note that running this command can remove critical
packages from your system.
43
Red Hat Enterprise Linux 9 Managing software with the DNF tool
Command Description
dnf module remove module_name:stream Remove packages from all installed profiles within
the specified stream.
dnf module disable module_name Disable a module and all its streams.
44