dnf. In this guide, you’ll learn how to register your system, configure repositories, and install, update, or remove packages. Most yum commands work identically with dnf; just replace yum with dnf where desired.
If you prefer
dnf over yum, you can use it interchangeably, for example:1. Registering with Red Hat Subscription Management
Before accessing Red Hat repositories, register and attach your system to a subscription.Ensure your subscription is active; expired subscriptions will prevent you from installing or updating packages.
2. Listing and Inspecting Repositories
A repository (repo) is a storage location—online or on your network—containing RPM packages, metadata, and signing keys.2.1 View Enabled Repositories
2.2 View Repository Details
Add-v for verbose details, including each repo’s URL and configuration file:
- Repo-baseurl: URL where YUM fetches packages
- Repo-filename: Local file under
/etc/yum.repos.d/
3. Enabling and Disabling Repositories
Some packages reside in optional or specialized repos.3.1 List All Repositories
3.2 Using Subscription Manager
Enable or disable by repo ID:3.3 Using yum-config-manager
First, installyum-utils:
4. Adding a Custom Repository
To add a third-party or local repo:.repo file in /etc/yum.repos.d/. Verify it:
5. Understanding a .repo File
Open the Docker repo for inspection:
| Field | Description |
|---|---|
[repo-id] | Unique identifier in brackets |
name= | Human-readable repository name |
baseurl= | URL to fetch packages |
enabled= | 1 to enable, 0 to disable |
gpgcheck= | 1 enforces GPG signature checking (recommended) |
gpgkey= | URL or file path to the GPG public key |
6. Searching for Packages
If you’re unsure of the exact name, useyum search. Single terms match any, quotes require both terms.
7. Viewing Package Information
Inspect a package before installation:8. Installing, Reinstalling, and Removing Packages
Install a new package:9. Managing Package Groups
YUM supports predefined groups (e.g., “Server with GUI”).| Command | Description |
|---|---|
sudo yum group list | List available groups |
sudo yum group list --hidden | Include hidden groups |
sudo yum group install 'Group Name' | Install a specific group |
sudo yum group remove 'Group Name' | Remove a specific group |
10. Installing from a Local RPM File
After downloading an RPM:11. Updating and Upgrading Packages
Check for available updates:If a kernel or critical component is updated, reboot to ensure changes take effect: