Welcome to Day 14 of the 30 Days of Linux Challenge!
Today, I tackled one of the most practical daily tasks in system administration: managing software and packages in Red Hat Linux using the dnf
and yum
tools.
This includes installing new applications, updating your system, working with repositories, and handling .rpm
packages manually โ all of which are vital whether you're building a dev environment, deploying production services, or maintaining critical infrastructure.
๐ Table of Contents
- Why Package Management Matters
- Installing and Removing Packages
- Searching and Listing Packages
- Updating and Cleaning Up
- Managing Repositories
- Working with RPM Packages Directly
- Try It Yourself
- Why This Matters in Real-World Environments
Why Package Management Matters
Every Linux system runs software. Managing packages is core to:
- Installing applications and utilities
- Keeping your system patched and secure
- Managing dependencies cleanly
- Automating deployments
Red Hat systems use RPM (Red Hat Package Manager) under the hood, and dnf
is the CLI tool that handles all modern interactions with it.
Installing and Removing Packages
Install a package:
sudo dnf install git
Remove a package:
sudo dnf remove git
Simple, clean, and fully dependency-aware.
Searching and Listing Packages
Search for a package:
dnf search nginx
List installed packages:
dnf list installed
List all available packages:
dnf list available
Updating and Cleaning Up
Update a single package:
sudo dnf update nginx
Update the entire system:
sudo dnf upgrade
Clean up cached packages:
sudo dnf clean all
Rebuild package cache:
sudo dnf makecache
Managing Repositories
Repositories are where your packages come from.
View enabled repos:
dnf repolist
Enable/disable a repo:
sudo dnf config-manager --set-enabled epel
sudo dnf config-manager --set-disabled epel
Add EPEL (Extra Packages for Enterprise Linux):
sudo dnf install epel-release
EPEL provides many community tools that arenโt in the base RHEL/AppStream repos.
Working with RPM Packages Directly
Sometimes youโll need to download and install .rpm packages manually.
Install with dnf:
sudo dnf install ./package.rpm
Or use rpm directly:
sudo rpm -ivh package.rpm
List installed packages with:
rpm -qa | grep nginx
Try It Yourself
Install a tool
sudo dnf install htop
Update your system
sudo dnf upgrade
Clean cache
sudo dnf clean all
Explore repos
dnf repolist
** Install EPEL repo**
sudo dnf install epel-release
Why This Matters in Real-World Environments
Whether you're:
- Spinning up cloud infrastructure
- Deploying containers or apps
- Maintaining a fleet of enterprise servers
- Package management is foundational to all of it.
It helps ensure consistency, automate deployments, and keep systems patched and secure โ especially important in regulated or production environments.
Top comments (0)