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 [dnf-options] [config-manager-options] [repoid ...]

PARAMETERS

--add-repo=URL
    Add and enable repo from remote or local .repo file

--dump
    Dump configuration variables of matching repos

--enable[=REPOPATTERN]
    Enable one or more repos by ID or glob pattern

--disable[=REPOPATTERN]
    Disable one or more repos by ID or glob pattern

--set-enabled={0|1} [repoid]
    Set enabled= flag (1=enabled, 0=disabled) for repos

--set-disabled={0|1} [repoid]
    Set disable= flag (1=disabled, 0=enabled) for repos

--save
    Save changes to repo files (required for persistence)

--enable-repos=REPOPATTERN
    Enable repos matching glob pattern

--disable-repos=REPOPATTERN
    Disable repos matching glob pattern

-v, --verbose
    Increase verbosity (repeat for more)

-q, --quiet
    Quiet operation, show less output

-c CONFIG_PATH, --config=CONFIG_PATH
    Use alternate DNF config file

--version
    Display dnf-config-manager version

-h, --help
    Show full help

DESCRIPTION

dnf config-manager is a command-line tool for modifying DNF (Dandified YUM) repository settings on Fedora, RHEL, CentOS Stream, and other RPM-based systems. It simplifies enabling, disabling, adding, or inspecting repositories defined in /etc/yum.repos.d/ without direct file editing.

Key features include pattern-based matching for repository IDs (repoids), dumping config variables for verification, and explicit control over enabled/disabled flags. For example, enable a repo with --enable repoid, disable with --disable, or set flags precisely using --set-enabled=1. Adding repos from remote .repo files is supported via --add-repo.

Changes are previewable with --dump and persisted using --save or implicitly. It supports glob patterns like *debug* for bulk operations. Integrated with DNF's caching and security, it's vital for curating trusted package sources, troubleshooting updates, or automating repo management in scripts.

Typically run as root, it ensures safe handling of system-wide configs, reducing errors from manual edits.

CAVEATS

Requires root privileges (use sudo). Modifies /etc/yum.repos.d/ files; backup first. Some actions need --save to persist. Glob patterns may match unexpectedly; test with --dump. Not for runtime repo changes—run dnf clean all after.

COMMON EXAMPLES

sudo dnf config-manager --enable crb
sudo dnf config-manager --set-enabled=0 fedora-debug
sudo dnf config-manager --add-repo https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf config-manager --dump '*'

REPO ID DISCOVERY

List available repos: dnf repolist all. IDs are lowercase, like fedora, updates.

HISTORY

Introduced with DNF 1.0 in Fedora 22 (2015) as successor to yum-config-manager. Enhanced in DNF 4+ with better glob support and integration. Actively maintained for RHEL 8/9 and Fedora.

SEE ALSO

dnf(8), dnf.conf(5), yum-config-manager(1)

Copied to clipboard