Chapter 3. Configuring DNF

The configuration information for DNF and related utilities is stored in the /etc/dnf/dnf.conf file. This file contains one mandatory [main] section, which enables you to set DNF options that have global effect.

In the following sections, learn how to configure DNF using the /etc/dnf/dnf.conf configuration file:

3.1. Viewing the current DNF configurations

To display the current DNF configuration, complete the following steps.

Procedure

  • To display the current values of global DNF options specified in the [main] section of the /etc/dnf/dnf.conf file, use:

    # dnf config-manager --dump

3.2. Setting DNF main options

The /etc/dnf/dnf.conf configuration file contains one [main] section. The key-value pairs in this section affect how DNF operates and treats repositories.

You can add additional options under the [main] section heading in /etc/dnf/dnf.conf.

For a complete list of available [main] options, see the [main] OPTIONS section of the dnf.conf(5) man page.

3.3. Using DNF plug-ins

DNF provides plug-ins that extend and enhance its operations. Certain plug-ins are installed by default.

3.3.1. Managing DNF plug-ins

The plug-in configuration files always contain a [main] section in which the enabled= option controls whether the plug-in is enabled when you run dnf commands. If this option is missing, you can add it manually to the file.

Every installed plug-in may have its own configuration file in the /etc/dnf/plugins/ directory. You can enable or disable plug-in specific options in these files.

3.3.2. Enabling and disabling DNF plug-ins

In the DNF tool, plug-ins are loaded by default.

To modify loading of DNF plug-ins, and enable or disable specific DNF plug-ins, complete the following steps.

Procedure

  • To disable or enable loading of DNF plug-ins, ensure a line beginning with plugins= is present in the [main] section of the /etc/dnf/dnf.conf file.

    1. To disable loading of DNF plug-ins, set the value of plugins= to 0.

      Important

      Disabling all plug-ins is not advised. Certain plug-ins provide important DNF services and commands. 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 advisable only when diagnosing a potential problem with DNF.

    2. To enable loading of DNF plug-ins, set the value of plugins= to 1.
  • 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 the update command:

    # dnf --noplugins update
  • To disable certain DNF plug-ins for a single command, append the --disableplugin=plugin-name option to the command. For example, to disable certain DNF plug-ins for the update command:

    # dnf update --disableplugin=plugin-name

    Replace plugin-name with the name of the plug-in.

  • To enable certain DNF plug-ins for a single command, append the --enableplugin=plugin-name option to the command. For example, to enable certain DNF plug-ins for the update command:

    # dnf update --enableplugin=plugin-name

    Replace plugin-name with the name of the plug-in.