Este conteúdo não está disponível no idioma selecionado.
Chapter 2. Configuring DNF
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 Copiar o linkLink copiado para a área de transferência!
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 Copiar o linkLink copiado para a área de transferência!
The /etc/dnf/dnf.conf file contains one [main] section. The key-value pairs in this section affect how DNF operates and treats repositories.
Procedure
-
Edit the
/etc/dnf/dnf.conffile. -
Update the
[main]section according to your requirements. - Save the changes.
2.3. Managing DNF plug-ins Copiar o linkLink copiado para a área de transferência!
Every installed plug-in can have its own configuration file in the /etc/dnf/plugins/ directory. Name plug-in configuration files in this directory <plug-in_name>.conf. By default, plug-ins are typically enabled. To disable a plug-in in one of these configuration files, add the following to the file:
[main] enabled=False
[main]
enabled=False
2.4. Enabling and disabling DNF plug-ins Copiar o linkLink copiado para a área de transferência!
In the DNF tool, plug-ins are loaded by default. However, you can influence which plug-ins DNF loads.
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
pluginsparameter to the[main]section of the/etc/dnf/dnf.conffile.-
Set
plugins=1(default) to enable loading of all DNF plug-ins. -
Set
plugins=0to disable loading of all DNF plug-ins.
-
Set
-
To disable a particular plug-in, add
enabled=Falseto the[main]section in the/etc/dnf/plugins/<plug-in_name>.conffile. To disable all DNF plug-ins for a particular command, append the
--nopluginsoption to the command. For example, to disable DNF plug-ins for a single update command, enter:dnf --noplugins update
# dnf --noplugins updateCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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:dnf update --disableplugin=<plugin_name>
# dnf update --disableplugin=<plugin_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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:dnf update --enableplugin=<plugin_name>
# dnf update --enableplugin=<plugin_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.5. Excluding packages from DNF operations Copiar o linkLink copiado para a área de transferência!
You can configure DNF to exclude packages from any DNF operation by using the excludepkgs option. You can define excludepkgs in the [main] or the repository section of the /etc/dnf/dnf.conf 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