Home·Terminal commands

dnf install

Packages and runtimes

Usage

sudo dnf install [-y] <package>

Installs from the enabled repositories and resolves dependencies, refreshing metadata on its own expiry so there is no separate update step as with apt; on RHEL 8 and later yum is a link to dnf, and Fedora 41 moved to dnf5.

Common flags

FlagMeaning
-yassume yes
--refreshexpire the metadata cache before resolving
--enablerepo=<repo>use a repository that is off by default
--setopt=install_weak_deps=Falseskip weak dependencies
--allowerasinglet it remove packages to satisfy the request
--nogpgcheckinstall without checking signatures

Examples

sudo dnf install -y git

installs with dependencies from the enabled repos

sudo dnf install --refresh nginx

refreshes metadata first, then installs

sudo dnf install ./package.rpm

installs a local rpm and resolves its dependencies

The question is always what goes where: inside this project, or on the whole machine.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does dnf install do?

Installs from the enabled repositories and resolves dependencies, refreshing metadata on its own expiry so there is no separate update step as with apt; on RHEL 8 and later yum is a link to dnf, and Fedora 41 moved to dnf5.

Q. How do I type it?

sudo dnf install [-y] <package> — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

6 are listed here; the full set is in man dnf. This command sits under Packages and runtimes.

Related commands

man page: man dnf-install