Packages and services

Command dnf

Manage packages in Fedora/RHEL

Linux · Bash examples · commands run on the selected server

When to use dnf

Use dnf on supported RPM-based distributions to inspect and install repository packages. Review repository trust, dependencies and the proposed transaction before making changes to a working server.

Syntax

dnf [PARAMETERS] ACTION [PACKAGE...]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

search
Find packages by description and name.
info
Description of the package and repository.
install
Install the package with dependencies.

Usage examples

Find package

dnf search tmux

Repository metadata is searched for relevant package matches.

View details

dnf info tmux

Package details are displayed without installation.

Install the selected package

sudo dnf install tmux

The selected package and required dependencies are proposed for installation.

Notes and limitations

  • Used in Fedora and a number of RHEL compatible systems; DNF 4 and DNF 5 differ in details.
  • Before confirming the transaction, check the packages being installed, updated, and removed.

Common questions and troubleshooting

Why does dnf not exist on my server?

Package managers depend on distribution and release. Identify the operating system before choosing an installation command.

Why is a transaction blocked by dependencies?

Installed versions, enabled repositories and policy can conflict. Investigate the reported constraints rather than forcing removal of unrelated packages.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man dnf.