Chapter 2. Configuring DNF
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
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=FalseTo 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 updateTo 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>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>
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> ...