RPM (Red Hat Package Manager) — Managing RPM Packages in Linux¶
RPM (Red Hat Package Manager) is the low-level package management system used by Red Hat Enterprise Linux (RHEL), Rocky Linux, AlmaLinux, Fedora, Oracle Linux, and other RPM-based distributions. While DNF and YUM manage software from repositories, RPM works directly with local
.rpmpackage files. Linux administrators use RPM to install, verify, query, and inspect software packages.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand RPM
- Install local RPM packages
- Upgrade packages
- Remove packages
- Query installed software
- Verify package integrity
- Inspect package contents
- Understand the relationship between RPM, YUM, and DNF
Prerequisites¶
Complete:
- Module 1 – Linux Fundamentals
- Module 2 – Linux Command Line Essentials
- Module 3 – Text Processing
- Module 4 – File Management and Permissions
- Module 5 – Users and Groups
- Module 6 – Process Management
- Module 7 Lessons 1–3
Why Learn RPM?¶
Imagine you receive:
or
from your company.
The package isn't available in any repository.
How do you install it?
The answer is:
What is RPM?¶
RPM stands for:
Red Hat Package Manager
It is the package management system used by RPM-based Linux distributions.
RPM works directly with package files.
Example:
RPM vs DNF/YUM¶
Whereas:
DNF and YUM use RPM internally to install packages.
RPM Package Structure¶
An RPM package typically contains:
- Executable files
- Libraries
- Configuration files
- Documentation
- Metadata
- Package scripts
Install an RPM Package¶
Example:
Options:
| Option | Meaning |
|---|---|
-i | Install |
-v | Verbose output |
-h | Display progress bar |
Upgrade an RPM Package¶
Example:
If the package already exists:
- Upgrade
Otherwise:
- Install
Fresh Install Only¶
Prevent upgrades.
Fails if the package is already installed.
Remove a Package¶
Example:
Use the package name—not the .rpm filename.
Query Installed Packages¶
List all installed packages.
Example:
Search Installed Packages¶
Display Package Information¶
Displays:
- Version
- Release
- Architecture
- Install date
- Vendor
- Description
List Files Installed by a Package¶
Example:
Find Which Package Owns a File¶
Output:
Useful when troubleshooting system files.
Verify an Installed Package¶
RPM compares installed files against package metadata.
If nothing is displayed,
the package matches the expected state.
Query an RPM File¶
Without installing:
Display package contents.
Verify Package Signature¶
This checks package integrity and signature information.
Common Commands¶
Install package.
Upgrade package.
Remove package.
List packages.
Package information.
List package files.
Real Production Examples¶
Install a monitoring agent.
Upgrade Kubernetes tools.
Verify Docker installation.
Identify the package that owns a binary.
Production Perspective¶
RPM is commonly used for:
- Installing vendor-provided software
- Offline package installation
- Enterprise software deployment
- Custom internal packages
- Troubleshooting package ownership
- Package verification
- Security auditing
Although DNF is preferred for repository-based installations, RPM is essential when working with standalone package files.
Hands-on Lab¶
Task 1¶
List installed packages.
Task 2¶
Search for Bash.
Task 3¶
View package information.
Task 4¶
List installed files.
Task 5¶
Identify which package owns /usr/bin/bash.
Task 6¶
Verify the Bash package.
Task 7¶
Display information from an RPM file.
(Replace package.rpm with an actual RPM file.)
Task 8¶
Verify an RPM package signature.
Command Deep Dive¶
| Command | Purpose | Production Example |
|---|---|---|
rpm -ivh | Install RPM package | Offline installation |
rpm -Uvh | Upgrade package | Software updates |
rpm -e | Remove package | Package cleanup |
rpm -qa | List installed packages | Inventory |
rpm -qi | Package information | Verification |
rpm -ql | List package files | File inspection |
rpm -qf | Identify package owner | Troubleshooting |
rpm -V | Verify package integrity | Security auditing |
rpm -K | Verify RPM signature | Package validation |
RPM vs DNF vs YUM¶
| Feature | RPM | DNF | YUM |
|---|---|---|---|
| Package Format | .rpm | .rpm | .rpm |
| Repository Support | ❌ | ✅ | ✅ |
| Dependency Resolution | ❌ | ✅ | ✅ |
| Install Local RPM | ✅ | ✅ | ✅ |
| Package Queries | ✅ | ✅ | ✅ |
| Package Verification | ✅ | Limited | Limited |
Production Troubleshooting Scenario¶
Scenario
A vendor provides:
The administrator installs it.
Installation fails.
Error:
Investigation:
RPM does not automatically resolve dependencies.
Solution:
Use:
or
These tools automatically download and install required dependencies.
Best Practices¶
- Prefer DNF or YUM for repository-managed software.
- Use RPM for local or vendor-provided packages.
- Verify package signatures before installation.
- Check package ownership when troubleshooting files.
- Verify installed packages regularly for integrity.
Common Mistakes¶
❌ Using RPM to install packages with unresolved dependencies.
✅ Avoid using RPM to install packages with unresolved dependencies when a safer approach exists.
❌ Removing critical packages without checking dependencies.
✅ Avoid this mistake: removing critical packages without checking dependencies.
❌ Installing unsigned packages from untrusted sources.
✅ Avoid this mistake: installing unsigned packages from untrusted sources.
❌ Confusing package names with RPM filenames.
✅ Distinguish clearly between package names with RPM filenames.
Interview Questions¶
Beginner¶
- What does RPM stand for?
- Which command installs an RPM package?
- How do you list installed packages?
- How do you remove an RPM package?
Intermediate¶
- What is the difference between
rpm -ivhandrpm -Uvh? - How do you determine which package owns a file?
- How do you verify package integrity?
- Why do DNF and YUM generally provide a better installation experience than RPM alone?
Architect Level¶
- When would you use RPM instead of DNF?
- How would you securely deploy vendor-provided RPM packages across enterprise servers?
- How would you validate the authenticity and integrity of an RPM package before deployment?
Summary¶
In this lesson, you learned:
- RPM package management
- Installing local RPM packages
- Package upgrades
- Package removal
- Package queries
- Package verification
- Package ownership
- Production best practices
RPM is the foundation of package management on RPM-based Linux systems. While DNF and YUM simplify dependency management and repository integration, RPM provides powerful tools for working directly with package files, verifying installations, and troubleshooting package-related issues.
Key Takeaways¶
- RPM is the low-level package manager for RPM-based distributions.
- Use
rpm -ivhto install local RPM packages. - Use
rpm -Uvhto upgrade existing packages. - Use
rpm -qato list installed packages. - Use
rpm -qfto identify the package that owns a file. - Use
rpm -Vandrpm -Kto verify package integrity and authenticity.
What's Next?¶
Snap — Universal Package Management for Linux
You'll explore:
- What Snap packages are
- Installing and removing Snap applications
- Managing Snap channels
- Automatic updates
- Sandboxed applications
- Differences between Snap and traditional package managers
- Production and desktop use cases
Snap provides a universal package format that allows applications to run consistently across multiple Linux distributions.