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
Viewing Detailed Repository Information
Add the-v (verbose) flag to see package counts, base URLs, mirror lists, and more:
Listing All Repositories (Enabled & Disabled)
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.
.repo file (find the path via dnf repolist -v).
Searching and Installing Packages
When you’re unsure of a package name, use:Viewing Package Details
- Name, Version, Release
- Architecture
- Repository
- Summary, License, Description
Common DNF Commands
| Command | Description |
|---|---|
sudo dnf search <term> | Search package names and descriptions |
sudo dnf info <package> | Display detailed package metadata |
sudo dnf install <package> | Install a package |
sudo dnf remove <package> | Uninstall a package |
sudo dnf reinstall <package> | Reinstall (restore) an existing package |
sudo dnf autoremove | Remove dependencies no longer required |
sudo dnf history | Show DNF transaction history |
Installing, Reinstalling, and Removing Packages
Install a Package
y when prompted.
Reinstall a Package
Restores missing or corrupted files:Remove a Package
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
Remove a Group
Show Hidden Groups
Installing Local RPMs
Download an RPM:Cleanup and Transaction History
- Remove orphaned dependencies:
- View transaction history:
Shell Completion Tips
Typednf and press Tab twice. Confirm with y to list all commands and subcommands.