Managing software with the DNF tool
Managing content in the RPM repositories by using the DNF software management tool
Abstract
Providing feedback on Red Hat documentation Copy linkLink copied to clipboard!
We appreciate your feedback on our documentation. Let us know how we can improve it.
Submitting feedback through Jira (account required)
- Log in to the Jira website.
- Click Create in the top navigation bar.
- Enter a descriptive title in the Summary field.
- Enter your suggestion for improvement in the Description field. Include links to the relevant parts of the documentation.
- Click Create at the bottom of the dialogue.
Chapter 1. Distribution of content in RHEL 10 Copy linkLink copied to clipboard!
In Red Hat Enterprise Linux (RHEL) 10, software is distributed through different repositories. You can access applications and core components through these repositories to ensure your system remains stable and up-to-date.
1.1. Repositories Copy linkLink copied to clipboard!
Red Hat Enterprise Linux (RHEL) 10 repositories, such as BaseOS or AppStream, provide the specific software, operating system functionality, and various system components you need for a stable and supported environment.
Red Hat Enterprise Linux distributes content through different repositories, for example, BaseOS, AppStream, CodeReady Linux Builder, and Supplementary. In addition, specific content is available in the Red Hat Enterprise Linux Add-on repositories, such as High Availability.
The main repositories that RHEL uses to distribute its content include the following repositories:
- 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.
Both the BaseOS and AppStream content sets are required by RHEL and are available in all RHEL subscriptions.
- CodeReady Linux Builder
- The CodeReady Linux Builder repository is available with all RHEL subscriptions. It provides additional packages for use by developers. Red Hat does not support packages included in the CodeReady Linux Builder repository.
1.2. Application Streams Copy linkLink copied to clipboard!
Red Hat provides multiple versions of user-space components as Application Streams, and they are updated more frequently than the core operating system packages. This provides more flexibility to customize RHEL without impacting the underlying stability of the platform or specific deployments.
Application Streams are available in the following formats:
- RPM format
- Software Collections
RHEL 10 provides initial Application Stream versions as RPMs, which you can install by using the dnf install command.
Each Application Stream has its own life cycle, and it can be the same or shorter than the life cycle of Red Hat Enterprise Linux 10. 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 Red Hat Enterprise Linux Application Stream life cycle first.
Chapter 2. Configuring DNF Copy linkLink copied to clipboard!
Customize software management on your Red Hat Enterprise Linux (RHEL) 10 system by configuring global settings and repository options for the DNF tool. You can adjust these parameters to optimize package downloads and ensure your environment meets specific operational requirements.
The configuration of DNF and related utilities is stored in the [main] section of the /etc/dnf/dnf.conf file.
2.1. Viewing the current DNF configurations Copy linkLink copied to clipboard!
Verify your software management settings by viewing the active DNF configuration. Reviewing these parameters ensures that your system uses the correct global and repository settings for efficient package management.
The [main] section in the /etc/dnf/dnf.conf file contains only the settings that have been explicitly set. However, you can display all settings of the [main] section, including the ones that have not been set and which, therefore, use their default values.
Procedure
Display the global DNF configuration:
dnf config-manager --dump
# dnf config-manager --dumpCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2. Setting DNF main options Copy linkLink copied to clipboard!
To control how DNF operates, configure key-value pairs in the [main] section of the /etc/dnf/dnf.conf file.
Procedure
-
Edit the
/etc/dnf/dnf.conffile. -
Update the
[main]section according to your requirements. - Save the changes.
2.3. Enabling and disabling DNF plugins Copy linkLink copied to clipboard!
Extend the functionality of the DNF tool by managing its plugins. By enabling or disabling plugins, you can activate or remove specific features to align with your environment’s operational requirements.
In the DNF tool, plugins are loaded by default. However, you can influence which plugins DNF loads.
Every installed plugin can have its own configuration file in the /etc/dnf/plugins/ directory. Name plugin configuration files in the <plugin_name>.conf directory. By default, plugins are typically enabled. You can manage plugins by either using different dnf commands or modifying the [main] section of the plugin’s configuration file.
Disable all plugins only for diagnosing a potential problem. DNF requires certain plugins, 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 plugins:
To enable or disable loading of DNF plugins globally, add the
pluginsparameter to the[main]section of the/etc/dnf/dnf.conffile.-
Set
plugins=1(default) to enable loading of all DNF plugins. -
Set
plugins=0to disable loading of all DNF plugins.
-
Set
To disable a particular plugin, add
enabled=Falseto the[main]section in the/etc/dnf/plugins/<plug-in_name>.conffile:[main] enabled=False
[main] enabled=FalseCopy to Clipboard Copied! Toggle word wrap Toggle overflow To disable all DNF plugins for a particular command, append the
--nopluginsoption to the command. For example, to disable DNF plugins for a single update command, enter:dnf --noplugins update
# dnf --noplugins updateCopy to Clipboard Copied! Toggle word wrap Toggle overflow To disable certain DNF plugins for a single command, append the
--disableplugin=<plugin-name>option to the command. For example, to disable a certain DNF plugin for a single update command, enter:dnf update --disableplugin=<plugin_name>
# dnf update --disableplugin=<plugin_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To enable certain DNF plugins for a single command, append the
--enableplugin=<plugin-name>option to the command. For example, to enable a certain DNF plugin for a single update command, enter:dnf update --enableplugin=<plugin_name>
# dnf update --enableplugin=<plugin_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.4. Excluding packages from DNF operations Copy linkLink copied to clipboard!
To prevent specific software from being installed or updated, exclude packages from DNF operations by using the excludepkgs option.
You can configure DNF to exclude packages from any DNF operation by using the excludepkgs option. You can define the excludepkgs option in the [main] or the repository section of the /etc/dnf/dnf.conf DNF configuration file.
You can temporarily disable excluding the configured packages from an operation by using the --disableexcludes option.
Procedure
Exclude packages from the DNF operation by adding the following line to the
/etc/dnf/dnf.conffile:excludepkgs=<package_name_1>,<package_name_2> ...
excludepkgs=<package_name_1>,<package_name_2> ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 3. Searching for RHEL content Copy linkLink copied to clipboard!
Search and examine content in the Red Hat Enterprise Linux (RHEL) 10 AppStream and BaseOS repositories by using the DNF tool. For example, you can identify specific packages or package groups to ensure you install the exact components required for your environment’s stability and security.
3.1. Searching for software packages Copy linkLink copied to clipboard!
Identify and locate the specific software for your Red Hat Enterprise Linux (RHEL) 10 system by searching for packages with the DNF tool. You can search by name or summary to ensure you find and install the correct components required for your environment.
Procedure
Depending on your scenario, use one of the following options to search the repository:
To search for a term in the name or summary of packages, enter:
dnf search <term>
$ dnf search <term>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To search for a term in the name, summary, or description of packages, enter:
dnf search --all <term>
$ dnf search --all <term>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note that searching additionally in the description by using the
--alloption 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:
dnf repoquery <package_name>
$ dnf repoquery <package_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To search for which package provides a file, specify the file name or the path to the file:
dnf provides <file_name>
$ dnf provides <file_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2. Listing software packages Copy linkLink copied to clipboard!
List available or installed packages on your Red Hat Enterprise Linux (RHEL) 10 system by using the DNF tool. You can use this information to confirm current versions and identify ready-to-install content to ensure your environment stays consistent and up-to-date.
Procedure
List the latest versions of all available packages, including architectures, version numbers, and the repository they where installed from:
dnf list --all
$ dnf list --allCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
@sign in front of a repository indicates that the package in this line is currently installed.Alternatively, to display all available packages, including version numbers and architectures, enter:
dnf repoquery
$ dnf repoqueryCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optionally, you can filter the output by using other options instead of
--all, for example:-
Use
--installedto list only installed packages. -
Use
--availableto list all available packages. -
Use
--upgradesto list packages for which newer versions are available.
-
Use
3.3. Displaying package information Copy linkLink copied to clipboard!
View detailed metadata for specific software in Red Hat Enterprise Linux (RHEL) 10 by displaying package information with the DNF tool. You can use this information to verify that a package meets your system requirements and security standards before installation.
You can display the following types of information related to the package:
- Version
- Release
- Architecture
- Package size
- Description
Procedure
Display information about one or more available packages:
dnf info <package_name>
$ dnf info <package_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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:
dnf repoquery --info <package_name>
$ dnf repoquery --info <package_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.4. Listing package groups and packages they provide Copy linkLink copied to clipboard!
List available package groups and their contents for your Red Hat Enterprise Linux (RHEL) 10 system by using the DNF tool. You can list package groups to quickly verify and install all required tools for specialized environments.
Procedure
List both installed and available groups:
dnf group list
$ dnf group listCopy to Clipboard Copied! Toggle word wrap Toggle overflow Note that you can filter the results by appending the
--installedand--availableoption to thednf group listcommand. By using the--hiddenoption, you can display hidden groups in the output.List mandatory, optional, and default packages contained in a particular group:
dnf group info "<group_name>"
$ dnf group info "<group_name>"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: View the number of installed and available groups:
dnf group summary
$ dnf group summaryCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.5. Listing repositories Copy linkLink copied to clipboard!
List enabled and disabled repositories on your Red Hat Enterprise Linux (RHEL) 10 system by using the DNF tool. You can review the repositories to identify available content and troubleshoot repository availability to ensure your environment can access the necessary software updates.
Procedure
List all enabled repositories on your system:
dnf repolist
$ dnf repolistCopy to Clipboard Copied! Toggle word wrap Toggle overflow To display only certain repositories, append one of the following options to the command:
-
Append
--disabledto list only disabled repositories. -
Append
--allto list both enabled and disabled repositories.
-
Append
Optional: List additional information about the repositories:
dnf repoinfo <repository_name>
$ dnf repoinfo <repository_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.6. Specifying glob expressions in DNF input Copy linkLink copied to clipboard!
Write more expressive DNF commands on your Red Hat Enterprise Linux (RHEL) 10 system by appending one or more glob expressions as arguments.
Many DNF commands accept glob expressions in place of package names, file paths, and other parameters. Glob expressions are strings of characters that contain one or more of the wildcard characters. By using glob expressions, you can efficiently search for large groups of related software and match paths without requiring exact matches for every item.
Procedure
Use one of the following methods if you use global expressions in
dnfcommands:Enclose the entire global expression in single or double quotation marks:
dnf provides "*/<file_name>"
# dnf provides "*/<file_name>"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note that you must precede
<file_name>either by/for an absolute path or*/to use a wildcard if the full path is unknown.Escape the wildcard characters by preceding them with a backslash (
\) character:dnf provides \*/<file_name>
# dnf provides \*/<file_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 4. Installing RHEL content Copy linkLink copied to clipboard!
Manually install software packages and package groups, which are not part of the default installation, on your Red Hat Enterprise Linux (RHEL) 10 system by using the DNF tool.
4.1. Installing packages Copy linkLink copied to clipboard!
Manually install software which is not part of the default installation on your Red Hat Enterprise Linux 10 (RHEL) system by using the DNF tool. During the package installation, DNF automatically resolves and installs package dependencies.
During the package installation, DNF automatically resolves and installs package dependencies.
Procedure
Use one of the following methods to install packages:
To install packages from the repositories, enter:
dnf install <package_name_1> <package_name_2> ...
# dnf install <package_name_1> <package_name_2> ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you install packages on a system that supports multiple architectures, such as
i686andx86_64, you can specify the architecture of the package by appending it to the package name:dnf install <package_name>.<architecture>
# dnf install <package_name>.<architecture>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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:
dnf install <path_to_file>
# dnf install <path_to_file>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To install a local RPM file, enter:
dnf install <path_to_RPM_file>
# dnf install <path_to_RPM_file>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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.
4.2. Installing package groups Copy linkLink copied to clipboard!
Package groups bundle multiple packages. Install all packages assigned to a package group to your Red Hat Enterprise Linux (RHEL) 10 system in a single step by using the DNF tool.
Prerequisites
- You know the name or ID of the group you want to install. For more information, see Listing package groups and packages they provide.
Procedure
Install a package group:
dnf group install <group_name_or_ID>
# dnf group install <group_name_or_ID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 5. Updating RHEL content Copy linkLink copied to clipboard!
To maintain the security and performance of your Red Hat Enterprise Linux (RHEL) 10 system, apply software updates by using the DNF tool. Regularly installing package and security updates ensures your environment remains stable, up-to-date, and protected against known vulnerabilities.
With the DNF tool, you can list packages that need updating and choose to update a single package, multiple packages, or all packages at once.
You can manage software updates in the Red Hat Enterprise Linux web console, which provides a graphical interface for DNF.
5.1. Checking for updates Copy linkLink copied to clipboard!
To ensure your Red Hat Enterprise Linux (RHEL) 10 system remains secure and efficient, check for available software updates by using the DNF tool. By identifying pending updates, you can plan maintenance windows and prioritize security fixes before applying changes to your environment.
Procedure
Check the available updates for installed packages:
dnf check-update
# dnf check-updateCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output returns the list of packages and their dependencies that have an update available.
5.2. Updating packages Copy linkLink copied to clipboard!
To maintain the security and stability of your Red Hat Enterprise Linux (RHEL) 10 system, install the latest software updates by using the DNF tool. Regularly applying package updates ensures your environment has essential security patches and bug fixes.
You can use DNF to update a single package, a package group, or all packages and their dependencies at once. If any of the packages you want to update have dependencies, DNF updates these dependencies as well.
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 the kernel, kernel-core, and kernel-modules packages.
If you upgraded the GRUB boot loader packages on a BIOS or IBM Power system, reinstall GRUB. See Reinstalling GRUB.
Procedure
Depending on your scenario, use one of the following options to apply updates:
To update all packages and their dependencies, enter:
dnf upgrade
# dnf upgradeCopy to Clipboard Copied! Toggle word wrap Toggle overflow To update a single package, enter:
dnf upgrade <package_name>
# dnf upgrade <package_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To update packages only from a specific package group, enter:
dnf group upgrade <group_name>
# dnf group upgrade <group_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 6. Automating software updates in RHEL Copy linkLink copied to clipboard!
Ensure your Red Hat Enterprise Linux (RHEL) 10 system remains secure and up-to-date by automating software updates with the DNF Automatic tool. Automatically installing security patches and bug fixes helps you maintain environment stability while reducing the effort for manual system maintenance.
DNF Automatic is an alternative command-line interface to DNF that is suited for automatic and regular execution by using systemd timers, cron jobs, and other such tools.
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
- 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.
6.1. Installing DNF Automatic Copy linkLink copied to clipboard!
Enable automatic software updates on your Red Hat Enterprise Linux (RHEL) 10 system by installing the DNF Automatic tool. Using this tool ensures your environment remains secure and up-to-date with the latest patches while significantly reducing the time and effort required for manual system maintenance.
Procedure
Install the
dnf-automaticpackage:dnf install dnf-automatic
# dnf install dnf-automaticCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify the successful installation by confirming the presence of the
dnf-automaticpackage:rpm -qi dnf-automatic
# rpm -qi dnf-automaticCopy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2. DNF Automatic configuration file Copy linkLink copied to clipboard!
The DNF Automatic configuration file defines the parameters for automated software updates in Red Hat Enterprise Linux (RHEL) 10. By managing these settings, you can customize update behaviors to maintain system security consistently with minimal manual effort.
By default, DNF Automatic uses /etc/dnf/automatic.conf as its configuration file to define its behavior. The configuration file has the following topical sections:
[commands]Sets the mode of operation of DNF Automatic.
WarningSettings of the operation mode from the
[commands]section are overridden by settings used by asystemdtimer unit for all timer units exceptdnf-automatic.timer.[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.
6.3. Enabling DNF Automatic Copy linkLink copied to clipboard!
Enable automated software updates on Red Hat Enterprise Linux (RHEL) 10 by activating DNF Automatic timer units. By enabling these units, you ensure your system remains consistently protected and up-to-date without requiring manual effort.
To run DNF Automatic once, you must start a systemd timer unit. However, if you want to run DNF Automatic periodically, you must enable a timer unit.
You can use one of the timer units provided in the dnf-automatic package, or you can create a drop-in file for the timer unit to adjust the execution time.
You can use the following timers:
-
dnf-automatic-download.timer: Downloads available updates. -
dnf-automatic-install.timer: Downloads and installs available updates. -
dnf-automatic-notifyonly.timer: Reports available updates. -
dnf-automatic.timer: Downloads, downloads and installs, or reports available updates.
Prerequisites
-
You specified the behavior of DNF Automatic by modifying the
/etc/dnf/automatic.confconfiguration file.
Procedure
To enable and execute a
systemdtimer unit immediately, enter:systemctl enable --now <timer_name>
# systemctl enable --now <timer_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you want to only enable the timer without executing it immediately, omit the
--nowoption.
Verification
Verify that the timer is enabled:
systemctl status <systemd_timer_unit>
# systemctl status <systemd_timer_unit>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Check when each of the timers on your system ran the last time:
systemctl list-timers --all
# systemctl list-timers --allCopy to Clipboard Copied! Toggle word wrap Toggle overflow
6.4. Overview of the systemd timer units included in the dnf-automatic package Copy linkLink copied to clipboard!
The systemd timer units in the dnf-automatic package provide the scheduling framework for automated software updates in Red Hat Enterprise Linux (RHEL) 10. Understanding these units helps you to customize the timing and frequency of update checks and patch applications.
The systemd timer units take precedence and override the settings in the /etc/dnf/automatic.conf configuration file when downloading and applying updates. 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, DNF will not download the packages.
The dnf-automatic package provides following systemd timer units:
| Timer unit | Function | Overrides the apply_updates and download_updates settings in the [commands] section of the /etc/dnf/automatic.conf file? |
|---|---|---|
|
| Downloads packages to cache and makes them available for updating.
This timer unit does not install the updated packages. To perform the installation, you must run the | Yes |
|
| Downloads and installs updated packages. | Yes |
|
| Downloads only repository data to keep the repository cache up-to-date and notifies you about available updates. This timer unit does not download or install the updated packages. | Yes |
|
|
The behavior of this timer when downloading and applying updates is specified by the settings in the This timer downloads packages, but does not install them. | No |
Chapter 7. Removing RHEL content Copy linkLink copied to clipboard!
To optimize your environment, remove unnecessary software from Red Hat Enterprise Linux (RHEL) 10 by using the DNF tool. Uninstalling unused packages and functional groups ensures your system remains clean, efficient, and secure.
7.1. Removing installed packages Copy linkLink copied to clipboard!
To optimize your Red Hat Enterprise Linux (RHEL) 10 system, remove unnecessary software packages by using the DNF tool. Uninstalling unused software ensures your environment remains secure and streamlined.
You can use DNF to remove a single package or multiple packages installed on your system. If any of the packages you want to remove have unused dependencies, DNF uninstalls these dependencies as well.
Procedure
Remove particular packages:
dnf remove <package_name_1> <package_name_2> ...
# dnf remove <package_name_1> <package_name_2> ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow
7.2. Removing package groups Copy linkLink copied to clipboard!
To optimize your Red Hat Enterprise Linux (RHEL) 10 system, uninstall collections of related software by removing package groups with the DNF tool. Uninstalling entire groups ensures your environment remains efficient and secure by removing all unnecessary components at once.
Package groups bundle multiple packages. You can use package groups to remove all packages assigned to a group in a single step.
Prerequisites
- You know the name or ID of the group you want to remove. For more information, see Listing package groups and packages they provide.
Procedure
Remove package groups by the group name or group ID:
dnf group remove <group_name> <group_ID>
# dnf group remove <group_name> <group_ID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 8. Handling package management history Copy linkLink copied to clipboard!
Track and manage software changes on your Red Hat Enterprise Linux (RHEL) 10 systems by using the DNF history database. By reviewing or reverting past transactions, you can quickly recover from accidental configuration changes.
You can perform various operations on the package management history by using the dnf history command. You can review the following information related to the DNF transactions:
- Timeline of transactions.
- Dates and times the transactions occurred.
- Number of packages affected by the transactions.
- Whether the transactions succeeded or were aborted.
- If the RPM database was changed between the transactions.
You can also use the dnf history command to undo operations performed during the transaction.
8.1. Listing DNF transactions Copy linkLink copied to clipboard!
To audit software changes or identify specific package operations, list the package management history on Red Hat Enterprise Linux (RHEL) 10 by using the DNF tool. Reviewing these transactions ensures you have a clear record of system modifications for maintenance and troubleshooting purposes.
By using the DNF tool, you can perform the following tasks:
- List the latest transactions.
- List the latest operations for a selected package.
- Display details of a particular transaction.
Procedure
Depending on your scenario, use one of the following options to display transaction information:
To display a list of all the latest DNF transactions, enter:
dnf history
# dnf historyCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output contains the following information:
-
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
Alteredcolumn 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)andAlteredcolumns, see thednf(8)man page.
-
The
To display a list of all the latest operations for a selected package, enter:
dnf history list <package_name>
# dnf history list <package_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To display details of a particular transaction, enter:
dnf history info <transaction_ID>
# dnf history info <transaction_ID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.2. Reverting DNF transactions Copy linkLink copied to clipboard!
To undo operations performed during DNF transactions on Red Hat Enterprise Linux (RHEL) 10, revert these transactions by using the DNF tool. By reverting transactions, you can quickly restore your system to a previous state. For example, if you installed several packages by using the dnf install command, you can uninstall these packages at once by reverting the installation transaction.
You can revert DNF transactions the following ways:
-
Revert a single DNF transaction by using the
dnf history undocommand. -
Revert all DNF transactions performed between the specified transaction and the last transaction by using the
dnf history rollbackcommand.
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 10.1 to RHEL 10.0) is not recommended because it might leave the system in an incorrect state.
8.2.1. Reverting a single DNF transaction Copy linkLink copied to clipboard!
To undo operations performed during a single DNF transaction on Red Hat Enterprise Linux (RHEL) 10, revert this transaction by using the DNF tool. By reverting the environment to a specific point in your package management history, you can recover from accidental changes and errors. Reverting a single transaction in DNF history will not undo or modify more recent transactions.
You can revert the transaction’s steps by using the dnf history undo command:
-
If the transaction installed a new package,
dnf history undouninstalls the package. -
If the transaction uninstalled a package,
dnf history undoreinstalls the package. The
dnf history undocommand also attempts to downgrade all updated packages to their previous versions if the older packages are still available.NoteIf an older package version is not available, the downgrade by using the
dnf history undocommand fails.
Procedure
Identify the ID of a transaction you want to revert:
dnf history
# dnf historyCopy to Clipboard Copied! Toggle word wrap Toggle overflow ID | Command line | Date and time | Action(s) | Altered -------------------------------------------------------------------- 13 | install zip | 2022-11-03 10:49 | Install | 1 12 | install unzip | 2022-11-03 10:49 | Install | 1
ID | Command line | Date and time | Action(s) | Altered -------------------------------------------------------------------- 13 | install zip | 2022-11-03 10:49 | Install | 1 12 | install unzip | 2022-11-03 10:49 | Install | 1Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Verify that this is the transaction you want to revert by displaying its details:
dnf history info <transaction_ID>
# dnf history info <transaction_ID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Revert the transaction:
dnf history undo <transaction_ID>
# dnf history undo <transaction_ID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example, if you want to uninstall the previously installed
unzippackage, enter:dnf history undo 12
# dnf history undo 12Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.2.2. Reverting multiple DNF transactions Copy linkLink copied to clipboard!
To undo operations performed during DNF transactions on Red Hat Enterprise Linux (RHEL) 10, revert these transactions by using the DNF tool. By reverting the environment to a specific point in your package management history, you can recover from accidental changes and errors.
You can revert all DNF transactions performed between a specified transaction and the last transaction by using the dnf history rollback command. Note that the transaction specified by the transaction ID remains unchanged.
Procedure
Identify the transaction ID of the state you want to revert to:
dnf history
# dnf historyCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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
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 EECopy to Clipboard Copied! Toggle word wrap Toggle overflow Revert specified transactions:
dnf history rollback <transaction_ID>
# dnf history rollback <transaction_ID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example, to revert to the state before the
wgetandunzippackages were installed, enter:dnf history rollback 12
# dnf history rollback 12Copy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, to revert all transactions in the transaction history, use the transaction ID
1:dnf history rollback 1
# dnf history rollback 1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 9. Managing custom software repositories Copy linkLink copied to clipboard!
To provide your Red Hat Enterprise Linux (RHEL) 10 systems with access to organization-specific or third-party software, add and configure custom repositories by using the DNF tool. By managing these custom sources, you can install and update specialized packages required for your environment.
You can configure a repository in the /etc/dnf/dnf.conf file or in a .repo file in the /etc/yum.repos.d/ directory.
The /etc/dnf/dnf.conf file contains the [main] section and can contain one or more repository sections with a unique repository ID in brackets ([]), for example, ([<repository-ID>]). You can use these sections to define individual DNF repositories by setting repository-specific options. Note that repository IDs must be unique. The values you define in individual repository sections of the /etc/dnf/dnf.conf file override values set in the [main] section for this repository.
For a complete list of available repository ID options, see the [<repository_ID>] OPTIONS section of the dnf.conf(5) man page.
Consider adding your custom repositories in separate .repo files instead of the /etc/dnf/dnf.conf DNF configuration file to avoid possible issues if other programs modify the DNF configuration file.
You can add the DNF repository to your system by using the dnf config-manager --add-repo command. Repositories that you add with this command are enabled by default. However, you can also use the dnf config-manager command to disable the repository.
Obtaining and installing software packages from unverified or untrusted sources other than Red Hat certificate-based Content Delivery Network (CDN) is a potential security risk, and can lead to security, stability, compatibility, and maintainability issues.
Procedure
Add a repository to your system:
dnf config-manager --add-repo <repository_URL>
# dnf config-manager --add-repo <repository_URL>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review and, optionally, update the repository settings that the previous command created in the
/etc/yum.repos.d/<repository_URL>.repofile:cat /etc/yum.repos.d/<repository_URL>.repo
# cat /etc/yum.repos.d/<repository_URL>.repoCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Disable the DNF repository added to your system:
dnf config-manager --disable <repository_ID>
# dnf config-manager --disable <repository_ID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To re-enable the repository, enter:
dnf config-manager --enable <repository_ID>
# dnf config-manager --enable <repository_ID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Appendix A. DNF commands list Copy linkLink copied to clipboard!
Use the following DNF commands to install, update, remove, and query system content.
A.1. Commands for listing content in RHEL Copy linkLink copied to clipboard!
Use the following DNF commands to search and examine available or installed software for your Red Hat Enterprise Linux (RHEL) 10 system.
| Command | Description |
|---|---|
|
| Search for a package by using term related to the package. |
|
| Search for enabled DNF repositories for a selected package and its version. |
|
| List information about all installed and available packages. |
|
| List all packages installed on your system. |
|
| List all packages in all enabled repositories that are available to install. |
|
| List all enabled repositories on your system. |
|
| List all disabled repositories on your system. |
|
| List both enabled and disabled repositories. |
|
| List additional information about the repositories. |
|
| Display details of an available package. |
|
| Display details of a package installed on your system. |
|
| View the number of installed and available groups. |
|
| List all installed and available groups. |
|
| List mandatory and optional packages included in a particular group. |
A.2. Commands for installing content in RHEL Copy linkLink copied to clipboard!
Use the following commands to install software on your Red Hat Enterprise Linux (RHEL) 10 system.
| Command | Description |
|---|---|
|
| Install a package. |
|
| Install multiple packages and their dependencies simultaneously. |
|
| Specify the architecture of the package by appending it to the package name when installing packages on a multilib system (AMD64, Intel 64 machine). |
|
| Install a binary by using the path to the binary as an argument. |
|
| Install a local RPM file. |
|
| Install a remote package by using a package URL. |
|
| Install a package group by a group name. |
|
| Install a package group by the group ID. |
A.3. Commands for removing content in RHEL Copy linkLink copied to clipboard!
Use the following DNF commands to uninstall software from your Red Hat Enterprise Linux (RHEL) 10 system.
| Command | Description |
|---|---|
|
| Remove a particular package and all dependent packages. |
|
| Remove multiple packages and their unused dependencies simultaneously. |
|
| Remove a package group by the group name. |
|
| Remove a package group by the group ID. |