// learn Β· linux Β· rhcsa Β· 9 min

Software with dnf / yum.

dnf (the modern successor to yum, drop-in compatible) manages everything from a single package to whole groups of related software. Watch a transaction take shape, then learn how to revert it, manage repos, and pick module streams.

dnf and yum package management animated tutorial. Search, install, remove, list, info, repo files, package groups, module streams, transaction history with rollback. RHCSA EX200 ready.
// dnf / yum

RHEL's package manager. Watch a transaction take shape, then learn the rollback, repo, and module commands that save you when things go sideways.

// before you start
you should know
  • Β·Comfortable running commands as root
  • Β·Helpful: vague idea what an RPM is
  • Β·Know what a software dependency is
by the end you'll

Install, upgrade, and remove with full transaction awareness; manage repos; pick module streams; undo any transaction with dnf history.

pace: 9 minutes

dnf β€” step 1 / 6 Β· search / info
$dnf search nginx
nginx.x86_64 : A high performance web server …

Search and inspect first

Before installing anything, find out what's available and what it actually does. `dnf search <term>` matches names and summaries; `dnf info <pkg>` shows the version, size, repo, license, and description. `dnf list --installed` shows what's already on the box. These read-only commands take zero risk.

$dnf search nginx
$dnf info nginx
$dnf list installed | grep ssh
$dnf provides /usr/bin/ss
// key insight

Two habits separate fluent admins from frantic ones: read the transaction preview before typing y, and treat dnf history as your time machine. Every install/upgrade/remove is one numbered entry; undo and rollback work on any of them. You almost never need to "reinstall the OS".

// exam-ready Β· dnf flags & files
$dnf search TERM
$dnf info PKG
$dnf provides /path/or/cmd
$dnf install PKG
$dnf install -y PKG
$dnf remove PKG
$dnf reinstall PKG
$dnf upgrade [PKG]
$dnf upgrade --security
$dnf list installed
$dnf history / info / undo / rollback
$dnf repolist
$dnf config-manager --set-enabled crb
$dnf group list / groupinstall 'X'
$dnf module enable nodejs:20
$/etc/yum.repos.d/*.repo
// check yourself
4 quick questions
Q1

After an upgrade, a service stops working. What's the fastest dnf-native way to revert?

Q2

What's a dnf MODULE STREAM and why use it?

Q3

Where do repository definitions live?

Q4

What does `dnf provides /usr/bin/ss` tell you?

These aren't graded β€” they're just for active recall, which is what actually makes the lesson stick.

πŸ“¦
// translate between distros

Package managers cheat sheet

Same command translated across dnf, apt, zypper, pacman β€” for when you switch distros and your muscle memory lies.

open β†’

Read this lesson as text6 chapters Β· quiz answers

  1. 01Search and inspect first

    Before installing anything, find out what's available and what it actually does. dnf search <term> matches names and summaries; dnf info <pkg> shows the version, size, repo, license, and description. dnf list --installed shows what's already on the box. These read-only commands take zero risk.

    • $ dnf search nginx β€” match names + summaries
    • $ dnf info nginx β€” version, size, license, desc
    • $ dnf list installed | grep ssh β€” what's installed
    • $ dnf provides /usr/bin/ss β€” which package owns this file
  2. 02Install β€” and read the transaction preview

    dnf install nginx shows you the FULL transaction before doing anything: the package itself, every dependency it pulls in, the size, and the total download. Type 'y' to confirm or 'N' to bail. -y skips the prompt (use in scripts, never blindly). Always read the list β€” that's where you catch unintended dependencies.

    • $ dnf install nginx β€” with confirmation
    • $ dnf install -y nginx β€” no prompt (scripts)
    • $ dnf reinstall nginx β€” restore overwritten files
    • $ dnf remove nginx β€” uninstall (incl. unused deps)
  3. 03Update and check

    dnf check-update lists packages with newer versions available β€” exit 0 = nothing, 100 = updates available (useful in scripts). dnf upgrade (or update β€” synonyms) downloads and installs them. By default it upgrades EVERYTHING; name a specific package to upgrade just that. dnf upgrade --security is the focused version for CVE patching.

    • $ dnf check-update β€” what's available?
    • $ dnf upgrade β€” upgrade everything
    • $ dnf upgrade nginx β€” just one
    • $ dnf upgrade --security β€” only CVE fixes
  4. 04Repositories β€” where packages come from

    Each .repo file in /etc/yum.repos.d/ defines a repository: a name, a baseurl (or mirrorlist), and whether it's enabled. dnf repolist shows the active ones. dnf config-manager --add-repo URL adds one; --set-enabled / --set-disabled NAME toggles. Third-party repos (EPEL, RPM Fusion) ship as packages β€” installing them drops their .repo file in for you.

    • $ dnf repolist β€” enabled repos
    • $ dnf repolist --all β€” incl. disabled
    • $ dnf install epel-release β€” add EPEL via package
    • $ dnf config-manager --set-enabled crb β€” enable a repo
    • $ ls /etc/yum.repos.d/ β€” where repos live
  5. 05Groups and module streams

    A group is a curated bundle (e.g. "Development Tools" = gcc + make + autoconf + …). dnf groupinstall 'Development Tools' pulls the lot. A module (RHEL 8+) is a versioned stream of an app β€” pick which major version of nodejs, postgresql, or ruby to install with dnf module enable <name>:<stream> before dnf install. Modules let one repo offer multiple parallel versions.

    • $ dnf group list β€” available groups
    • $ dnf groupinstall 'Development Tools' β€” install a group
    • $ dnf module list β€” all modules
    • $ dnf module enable nodejs:20 β€” pin a stream
    • $ dnf module reset nodejs β€” unpin
  6. 06History β€” every transaction is reversible

    Every dnf transaction (install, upgrade, remove) gets a numbered entry in dnf history. View one with dnf history info <id>. Undo with dnf history undo <id> β€” it reverses the changes (uninstalls what was installed, reinstalls what was removed). dnf history rollback <id> rolls the whole system back to that point. This is your safety net after a bad upgrade.

    • $ dnf history β€” list transactions
    • $ dnf history info 7 β€” what did tx #7 do
    • $ dnf history undo 7 β€” reverse just that tx
    • $ dnf history rollback 5 β€” roll back to that point

Quiz β€” answers

After an upgrade, a service stops working. What's the fastest dnf-native way to revert?
β†’dnf history list, find the bad transaction ID, dnf history undo <id> (or rollback to a prior id).Every dnf transaction is recorded. history undo reverses one tx; history rollback <id> brings the system back to the state right after that earlier tx. It's the closest thing to git revert/reset for packages.
What's a dnf MODULE STREAM and why use it?
β†’A versioned variant of a package shipped in one repo β€” e.g. nodejs:20 vs nodejs:18. Pick one with dnf module enable nodejs:20 so a single repo can offer multiple major versions without conflict.Modules + streams let RHEL ship multiple major versions of the same app from one repo. Enable a stream, then install β€” the right version comes in. Reset the module to unpin.
Where do repository definitions live?
β†’/etc/yum.repos.d/*.repo (each file is one or more repos with name, baseurl, enabled, gpgcheck).Each .repo file under /etc/yum.repos.d/ defines a repo. dnf repolist shows the enabled ones. Add new ones with dnf config-manager --add-repo URL or by installing a vendor 'release' package (epel-release, etc.).
What does dnf provides /usr/bin/ss tell you?
β†’Which package provides (owns) the file /usr/bin/ss β€” useful for figuring out 'I need this command, what do I install?'dnf provides does a reverse lookup from a file path or capability to the package that supplies it. Great when you know the command name but not the package name.
// more in linux

keep going β€” these pair well with what you just learned.

see all linux β†’

See also

back to RHCSA trackall lessons