🧰 Linux/Unix: RHEL-Based Package Management – yum, dnf, rpm Explained with Examples

🧲 Introduction – Why Learn RHEL-Based Package Managers?

If you’re working with Red Hat Enterprise Linux (RHEL), CentOS, Rocky Linux, or Fedora, you’ll manage software using yum, dnf, and rpm. These tools help install, update, and troubleshoot packages using .rpm files and repositories.

🎯 In this guide, you’ll learn:

  • How to manage software with yum, dnf, and rpm
  • Key differences and use cases for each tool
  • Real command-line examples and practical tips

🍽️ 1. yum – Yellowdog Updater, Modified

βœ… What is yum?

yum is a high-level package manager used in RHEL-based systems to install, remove, and update software. It handles dependencies and works with online or local repositories.

πŸ› οΈ Syntax:

sudo yum [command] [package]

πŸ”Ή Common yum Commands:

CommandDescription
installInstall a package
removeRemove a package
updateUpdate all packages
searchSearch for a package
infoShow package details
list installedList all installed packages

πŸ§ͺ Example:

sudo yum install httpd

πŸ“€ Output:

Installed:
  httpd.x86_64 0:2.4.6-97.el7.centos

βœ… Update all packages:

sudo yum update

βš™οΈ 2. dnf – Dandified Yum (Modern Replacement)

βœ… What is dnf?

dnf is the modern replacement for yum, available in Fedora and RHEL 8+. It offers better performance, dependency handling, and transaction history.

πŸ› οΈ Syntax:

sudo dnf [command] [package]

πŸ”Ή Common dnf Commands:

CommandDescription
installInstall packages with dependencies
removeRemove packages
upgradeUpdate all system packages
searchSearch available packages
infoShow detailed package info
historyView transaction history

πŸ§ͺ Example:

sudo dnf install vim

πŸ“€ Output:

Installed:
  vim-enhanced-2:8.0.1763-19.el8.x86_64

βœ… View install/remove history:

dnf history

πŸ“¦ 3. rpm – Red Hat Package Manager (Low-Level)

βœ… What is rpm?

rpm is the low-level tool for installing .rpm files directly. It doesn’t resolve dependencies automatically.

πŸ› οΈ Syntax:

sudo rpm [option] package.rpm

πŸ”Ή Common rpm Commands:

CommandDescription
-iInstall a package
-UUpgrade a package
-eErase/remove a package
-qQuery installed package
-qlList files of a package
-qf [file]Find which package owns a file

πŸ§ͺ Example 1: Install .rpm package

sudo rpm -ivh google-chrome.rpm

πŸ“€ Output:

Preparing...                #################################
Updating / installing...
   1:google-chrome-stable   #################################

πŸ§ͺ Example 2: Check if a package is installed

rpm -q wget

🧠 If dependencies are missing:

sudo yum install -y --skip-broken

🧠 Tool Comparison: yum vs dnf vs rpm

Featureyumdnfrpm
Dependency resolutionβœ…βœ…βŒ
Repository usageβœ…βœ…βŒ (local files only)
Speed & performanceMediumFasterFast (local)
Script-friendlyβœ…βœ…βœ…
Recommended useLegacy systemsModern RHEL & FedoraManual package install

πŸ“Œ Summary – Recap & Next Steps

For RHEL-based distributions, mastering yum, dnf, and rpm lets you confidently manage packages, perform updates, and install offline software. Use yum/dnf for regular tasks and rpm for low-level control.

πŸ” Key Takeaways:

  • Use yum or dnf for automatic dependency management.
  • Use dnf on newer systems (RHEL 8+, Fedora).
  • Use rpm for manual .rpm installs or queries.

❓ FAQs

❓ What’s the difference between yum and dnf?
βœ… dnf is a modern replacement for yum, offering better performance, rollback, and modular support.

❓ Can I still use yum on RHEL 8?
βœ… Yes, but it’s a symlink to dnf internally.

❓ How do I fix a broken rpm install?
βœ… Use:

sudo yum install -f

❓ How do I list all .rpm packages installed?
βœ… Run:

rpm -qa

❓ Can I uninstall a package installed with rpm using dnf?
βœ… Yes. All managers interface with the same underlying RPM database.


Share Now :

Leave a Reply

Your email address will not be published. Required fields are marked *

Share

πŸ”΅ Linux/Unix: RHEL-based (yum, dnf, rpm)

Or Copy Link

CONTENTS
Scroll to Top