LinuxCommandLibrary

dnf-config-manager

Manage DNF repository configurations

TLDR

Add (and enable) a repository from a URL

$ dnf config-manager --add-repo=[repository_url]
copy

Print current configuration values
$ dnf config-manager --dump
copy

Enable a specific repository
$ dnf config-manager [[--enable|--set-enabled]] [repository_id]
copy

Disable specified repositories
$ dnf config-manager [[--disable|--set-disabled]] [repository_id1 repository_id2 ...]
copy

Set a configuration option for a repository
$ dnf config-manager --setopt=[option]=[value]
copy

Display help
$ dnf config-manager --help-cmd
copy

SYNOPSIS

dnf-config-manager [options] [repository_id...]

Common Usage Patterns:
dnf-config-manager {--set-enabled | --set-disabled} repository_id...
dnf-config-manager --add-repo URL
dnf-config-manager --dump
dnf-config-manager --save [--setopt=<repository_id>.<option>=<value>]...

PARAMETERS

--set-enabled ...
    Enable one or more specified DNF repositories. This sets the 'enabled' flag to '1' in their respective configuration files.

--set-disabled ...
    Disable one or more specified DNF repositories. This sets the 'enabled' flag to '0', making them inactive for DNF operations.

--add-repo
    Add a new repository configuration. The URL can point to a .repo file directly or to a directory containing .repo files.

--dump
    Display the current configuration for all known DNF repositories, including their IDs, enabled status, and other parameters.

--save
    Save the current configuration changes to disk. This option is typically used in conjunction with --setopt to make changes persistent.

--setopt=.
    Set a specific option for a given repository. For example, --setopt=myrepo.gpgcheck=0 or --setopt=myrepo.baseurl=http://example.com/repo.

--enable ...
    An alias for --set-enabled, providing a more intuitive syntax for enabling repositories.

--disable ...
    An alias for --set-disabled, providing a more intuitive syntax for disabling repositories.

--destdir=
    Specify an alternative destination directory for new .repo files when using --add-repo. Defaults to /etc/yum.repos.d/.

DESCRIPTION

dnf-config-manager is a utility that allows system administrators to easily manage DNF (Dandified YUM) repository configurations. It provides a command-line interface to enable, disable, and modify options for specific DNF repositories. This tool operates on the .repo files typically found in /etc/yum.repos.d/, offering a safer and more consistent way to manipulate these settings than manual file editing. It simplifies tasks such as adding new repository sources, enabling/disabling third-party repositories, or adjusting specific parameters like baseurl, gpgcheck, or enabled flags. It is an essential component for managing software sources on Fedora, RHEL, CentOS, and other DNF-based Linux distributions, ensuring that dnf operates with the correct and desired repository configurations.

CAVEATS

Modifying system-wide DNF repository configurations using dnf-config-manager typically requires root privileges (or sudo). Direct manual editing of configuration files in /etc/yum.repos.d/ is generally discouraged as it can lead to inconsistent configurations or be overwritten by tool actions. Be cautious when disabling essential system repositories, as this can affect system updates and package availability.

CONFIGURATION FILE LOCATION

dnf-config-manager primarily interacts with DNF repository configuration files, which are standard INI-like text files typically found in the directory /etc/yum.repos.d/. Each .repo file in this directory defines one or more repositories with their settings.

IMPACT ON DNF OPERATIONS

Any changes made using dnf-config-manager (e.g., enabling or disabling a repository, or changing a repository option) are immediately active and will affect subsequent dnf package management operations, such as installing, updating, or removing packages, without needing to restart any services.

HISTORY

dnf-config-manager emerged as the DNF package manager replaced YUM in modern Fedora, RHEL 8+, and CentOS Stream distributions. It is the spiritual successor and modern equivalent of yum-config-manager from the YUM ecosystem, providing consistent and robust repository management capabilities. It is distributed as part of the dnf-plugins-core package.

SEE ALSO

dnf(8), dnf.conf(5), dnf-plugins-core(7), yum-config-manager(8)

Copied to clipboard