Skip to main content
In this guide, you’ll master software management on CentOS Stream 8 using DNF—the modern package manager. Whether you’re installing web servers, managing repositories, or cleaning up unused dependencies, DNF provides a consistent CLI. If you’re on an older CentOS release without DNF, substitute yum for dnf in the examples below (for instance, use sudo yum install nginx).
CentOS Stream 8 uses DNF by default. For legacy CentOS 7 or earlier, replace dnf with yum in all commands.

Software Repositories

A software repository is a server that hosts packages—programs, libraries, configurations, and more. CentOS Stream 8 includes several repositories out of the box.

Listing Enabled Repositories

Output:

Viewing Detailed Repository Information

Add the -v (verbose) flag to see package counts, base URLs, mirror lists, and more:

Listing All Repositories (Enabled & Disabled)

Sample output:

Enabling or Disabling Optional Repositories

Adding a Third-Party Repository

To install packages not found in official repos, add a third-party repository:
Third-party repositories can introduce unverified software. Only add trusted sources.
To remove it later, delete its .repo file (find the path via dnf repolist -v).

Searching and Installing Packages

When you’re unsure of a package name, use:
To search for the exact phrase:

Viewing Package Details

Sample fields:
  • Name, Version, Release
  • Architecture
  • Repository
  • Summary, License, Description

Common DNF Commands


Installing, Reinstalling, and Removing Packages

Install a Package

Confirm with y when prompted.

Reinstall a Package

Restores missing or corrupted files:

Remove a Package

You can specify full name/version/arch (e.g., libcurl-7.61.1-22.el8.x86_64) or just libcurl.

Managing Package Groups

DNF groups bundle related packages (e.g., a desktop environment).

List Groups

Install an Environment Group

Include optional packages:

Remove a Group

Show Hidden Groups


Installing Local RPMs

Download an RPM:
Install it:
Remove it:

Cleanup and Transaction History

  • Remove orphaned dependencies:
  • View transaction history:

Shell Completion Tips

Type dnf and press Tab twice. Confirm with y to list all commands and subcommands.

References

Watch Video