Configuring the Global DNF Configuration Settings

Edit the main configuration in /etc/dnf/dnf.conf. The global definitions for DNF are located under the [main] section heading of the DNF configuration file. The following table lists important directive for DNF.

Note:

For backward-compatibility purposes, a symbolic link to /etc/dnf/dnf.conf is created at /etc/yum.conf. The configuration syntax is the same; although, some configuration options have been deprecated and some new configuration options have been added. See Comparing Yum Version 3 With DNF for a list of the differences between configuration options and syntax.

See the dnf.conf(5) manual page for more information.

Directive Description
cachedir Directory used to store downloaded packages.
debuglevel Logging level, from 0 (none) to 10 (all).
exclude A space separated list of packages to exclude from installs or updates, for example: exclude=VirtualBox-4.? kernel*.
gpgcheck If set to 1, verify the authenticity of the packages by checking the GPG signatures. You might need to set gpgcheck to 0 if a package is unsigned, but be wary that the package could have been maliciously altered.
gpgkey Path to the GPG public key file.
installonly_limit Maximum number of versions that can be installed of any one package.
keepcache If set to 0, remove packages after installation.
logfile Path to the dnf log file.
obsoletes If set to 1, replace obsolete packages during upgrades.
plugins If set to 1, enable plugins that extend the functionality of dnf.
proxy URL of a proxy server including the port number. See Configuring a System to Use a Proxy With a Yum Server
proxy_password Password for authentication with a proxy server.
proxy_username Username for authentication with a proxy server.
reposdir Directories where dnf looks for repository files with a .repo extension. The default directory is /etc/yum.repos.d. See Subscribing to Different Yum Repositories.

Example [main] Configuration

The following listing shows an example [main] section from the DNF configuration file.

[main]
cachedir=/var/cache/dnf
keepcache=0
debuglevel=2
logfile=/var/log/dnf.log
obsoletes=1
gpgkey=file://media/RPM-GPG-KEY
gpgcheck=1
plugins=1
installonly_limit=3