LinuxCommandLibrary

dnf5

Manage software packages with dnf5

TLDR

Upgrade installed packages to the newest available versions

$ sudo dnf5 upgrade
copy

Search packages via keywords
$ dnf5 search [keyword1 keyword2 ...]
copy

Display details about a package
$ dnf5 info [package]
copy

Install new packages (Note: Use -y to confirm all prompts automatically)
$ sudo dnf5 install [package1 package2 ...]
copy

Remove packages
$ sudo dnf5 remove [package1 package2 ...]
copy

List installed packages
$ dnf5 list --installed
copy

Find which packages provide a given command
$ dnf5 provides [command]
copy

Remove or expire cached data
$ sudo dnf5 clean all
copy

SYNOPSIS

dnf5 [options] <command> [<args>]

PARAMETERS

--assumeyes, -y
    Automatically answer "yes" to prompts.

--assumeno
    Automatically answer "no" to prompts.

--best
    Resolve dependencies using the best available versions.

--allowerasing
    Allow erasing packages to resolve dependencies.

--skip-broken
    Skip packages with broken dependencies.

--refresh
    Update metadata before running the command.

--cacheonly
    Use cached metadata only, no downloads.

--downloadonly
    Download packages but do not install.

--installroot=PATH
    Set alternate installation root.

--releasever=VER
    Set release version for repositories.

--enablerepo=ID
    Enable specific repository(s) for this transaction.

--disablerepo=ID
    Disable specific repository(s) for this transaction.

--exclude=PKG
    Exclude packages from updates.

--config=FILE
    Use alternative config file.

--setopt=option=value
    Override runtime options.

-v, --verbose
    Increase verbosity level.

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

--version
    Display version information.

--help
    Show help message.

-C
    Run without updating filelists database.

DESCRIPTION

DNF5 is the modern successor to the DNF package manager, serving RPM-based distributions like Fedora, RHEL, and CentOS Stream. It offers a command-line interface for installing, updating, removing, and querying software packages, handling dependencies, repositories, and system updates efficiently.

Powered by the new libdnf5 library in C++17, DNF5 delivers superior performance through a faster SAT solver (libsolv-based), modular architecture, and optimized RPM backend. Features include atomic transactions, goal-based management via Goalfile, enhanced plugin support, better error diagnostics, and composability for tools like microdnf.

Maintaining API compatibility with DNF4, it supports familiar workflows while introducing improvements like metadata prefetching, selective repo enabling, and advanced querying. DNF5 excels in large-scale environments, reducing solve times and memory usage. Ideal for servers, desktops, and containers, it ensures secure GPG verification and flexible configuration.

Transitioning is straightforward; most scripts and habits carry over, with gains in speed and reliability.

CAVEATS

DNF5 is actively developed; some DNF4 plugins lack ports. Metadata format differs slightly from DNF4—ensure repo compatibility. Not yet fully stable in all edge cases.

COMMON SUBCOMMANDS

install, reinstall, upgrade, update, remove, autoremove, search, list, info, provides, repoquery, clean, history, makecache.

EXAMPLES

dnf5 update
Update all packages.

dnf5 install package
Install specified package.

dnf5 search keyword
Search for packages.

HISTORY

DNF5 emerged from Fedora Project in 2022 to replace aging DNF4. Rewritten with libdnf5 in C++ for modularity and speed, it debuted in Fedora 38 (2023 alpha), matured in 39/40 betas, and became default in Fedora 42 (2024). Focuses on solver efficiency, goal management, and ecosystem integration amid shift to OSTree/ rpm-ostree.

SEE ALSO

dnf(8), microdnf(8), dnf5.conf(5), libdnf5(7), rpm(8)

Copied to clipboard