RHEL-based distributions (Red Hat Enterprise Linux, CentOS, Fedora, Rocky Linux, AlmaLinux, Oracle Linux) use the RPM (Red Hat Package Manager) package format and associated tools for software management.
An RPM package is a file with .rpm extension containing:
.rpm
Compiled binaries
Configuration files
Documentation
Metadata (name, version, dependencies, architecture)
Pre/post installation scripts
package-name-version-release.architecture.rpm
Example: httpd-2.4.37-43.el8.x86_64.rpm
httpd = package name
2.4.37 = version
43 = release number
el8 = Enterprise Linux 8
x86_64 = architecture (64-bit Intel/AMD)
x86_64 - 64-bit Intel/AMD
x86_64
i686 - 32-bit Intel/AMD
i686
noarch - Architecture independent
noarch
aarch64 - 64-bit ARM
aarch64
src - Source RPM
src
# Install a package
sudo rpm -ivh package.rpm
# -i = install
# -v = verbose
# -h = hash marks (progress bar)
# Install without dependencies check (not recommended)
sudo rpm -ivh --nodeps package.rpm
# Upgrade a package (install if not present)
sudo rpm -Uvh package.rpm
# Freshen (upgrade only if already installed)
sudo rpm -Fvh package.rpm
# Force installation (overwrite existing)
sudo rpm -ivh --force package.rpm
# Remove a package
sudo rpm -e package_name
# Remove without checking dependencies (dangerous)
sudo rpm -e --nodeps package_name
# Remove and show progress
sudo rpm -evh package_name
# List all installed packages
rpm -qa
# List with pipe to search
rpm -qa | grep package_name
# Query specific package
rpm -q package_name
# Get detailed information about installed package
rpm -qi package_name
# Get information from RPM file (not installed)
rpm -qip package.rpm
# List files in installed package
rpm -ql package_name
# List files in RPM file (not installed)
rpm -qlp package.rpm
# Find which package owns a file
rpm -qf /path/to/file
# Show package dependencies
rpm -qR package_name
# Show what packages require this package
rpm -q --whatrequires package_name
# List documentation files
rpm -qd package_name
# List configuration files
rpm -qc package_name
# Show changelog
rpm -q --changelog package_name
# List recently installed packages
rpm -qa --last | head -20
# Verify a package (check for modifications)
rpm -V package_name
# Verify all packages
rpm -Va
# Verify from RPM file
rpm -Vp package.rpm
Verification Output Codes:
S = File size differs
M = Mode differs (permissions)
5 = MD5 checksum differs
D = Device major/minor number mismatch
L = readLink path mismatch
U = User ownership differs
G = Group ownership differs
T = mTime differs
P = caPabilities differ
# Import RPM GPG key
sudo rpm --import /path/to/RPM-GPG-KEY
# List imported keys
rpm -qa gpg-pubkey*
# Show key details
rpm -qi gpg-pubkey-<key-id>
High-level package manager
Handles dependencies automatically
Works with repositories
Used in RHEL/CentOS 7 and earlier
sudo yum install package_name
# Install multiple packages
sudo yum install package1 package2 package3
# Install specific version
sudo yum install package_name-version
# Install from local RPM (resolves dependencies)
sudo yum localinstall package.rpm
sudo yum remove package_name
# Remove with dependencies
sudo yum autoremove package_name
# Update all packages
sudo yum update
# Update specific package
sudo yum update package_name
# Check for updates without installing
sudo yum check-update
# Upgrade all packages (obsoletes old packages)
sudo yum upgrade
# Reinstall a package
sudo yum reinstall package_name
# Downgrade a package
sudo yum downgrade package_name
# Search for a package
yum search keyword
# Show package information
yum info package_name
# List all available packages
yum list available
# List installed packages
yum list installed
# List updates available
yum list updates
# Show which package provides a file
yum provides /path/to/file
yum whatprovides */filename
# List package groups
yum grouplist
# Get group information
yum groupinfo "Group Name"
# Install package group
sudo yum groupinstall "Development Tools"
# Remove package group
sudo yum groupremove "Group Name"
# List enabled repositories
yum repolist
# List all repositories (enabled and disabled)
yum repolist all
# Enable a repository for single command
sudo yum --enablerepo=repo_name install package_name
# Disable a repository for single command
sudo yum --disablerepo=repo_name install package_name
# Add repository
sudo yum-config-manager --add-repo repository_url
# Enable repository
sudo yum-config-manager --enable repo_name
# Disable repository
sudo yum-config-manager --disable repo_name
Modern replacement for YUM
Default in Fedora, RHEL 8+, CentOS 8+
Better performance and dependency resolution
Uses libsolv for dependency solving
Lower memory usage
Supports modular repositories
# Install package
sudo dnf install package_name
# Install with automatic yes
sudo dnf install -y package_name
# Remove package
sudo dnf remove package_name
sudo dnf update
sudo dnf update package_name
# Upgrade (same as update in DNF)
sudo dnf upgrade
# Check for updates
sudo dnf check-update
# Reinstall package
sudo dnf reinstall package_name
# Downgrade package
sudo dnf downgrade package_name
# Install local RPM
sudo dnf install ./package.rpm
# Autoremove orphaned dependencies
sudo dnf autoremove
What does RPM stand for and what is its file extension?
RPM stands for Red Hat Package Manager. File extension is .rpm
Explain the RPM naming convention: httpd-2.4.37-43.el8.x86_64.rpm
httpd-2.4.37-43.el8.x86_64.rpm
x86_64 = 64-bit architecture
What is the command to install an RPM package with verbose output and progress bar?
-i = install
-v = verbose
-h = hash marks (progress)
What is the difference between rpm -U and rpm -F?
rpm -U
rpm -F
rpm -U (Upgrade): Installs package if not present, upgrades if exists
rpm -F (Freshen): Only upgrades if package is already installed
How do you query all installed packages using RPM?
What command shows which package owns a specific file?
How do you list all files installed by a package?
How do you verify the integrity of an installed package?
rpm -V package_name (or rpm -Va for all packages)
What do the following verification codes mean: S, M, 5?
What is the main difference between RPM and YUM/DNF?
RPM is a low-level tool that doesn't handle dependencies automatically. YUM/DNF are high-level tools that automatically resolve and install dependencies.
What command installs a package using YUM?
How do you update all packages on the system with YUM?
What is the difference between yum update and yum upgrade?
yum update
yum upgrade
yum update: Updates packages
yum upgrade: Updates packages AND removes obsolete packages
How do you search for a package using YUM?
Last changeda month ago