๐ฆ Day 3 of #150DaysOfDevOps โ Introduction to Linux Package Management

Package management is at the heart of Linux system administration. Whether you're installing software, updating dependencies, or maintaining a clean environment, package managers make life easier for DevOps professionals.
In this blog, we'll cover key package managers used in Debian-based and RedHat-based Linux distributions:
๐ค What is a Package?
A package is a compressed archive that contains all the files needed for a software to run: binaries, libraries, config files, metadata, and more.
For example:
gimp.deb
โ for Debian-based systemsfirefox.rpm
โ for RedHat-based systems
โ๏ธ Why Package Managers?
With hundreds of Linux distributions and diverse libraries/tools, direct installation of packages often fails due to dependency hell. Package managers:
Automate dependency resolution
Ensure system compatibility
Streamline software installation and upgrades
๐ง Package Managers by Distribution
Distribution | Package Format | Low-Level Tool | High-Level Tool |
Ubuntu / Debian | .deb | dpkg | apt , apt-get |
RHEL / CentOS / Fedora | .rpm | rpm | yum , dnf |
๐ด RPM (Red Hat Package Manager)
RPM is a low-level tool used in RedHat-based distributions.
Common Commands:
# Install a package
sudo rpm -ivh package.rpm
# Remove a package
sudo rpm -e package-name
# Query installed packages
rpm -qa | grep wget
โ Limitation:
Does not resolve dependencies on its own.
๐ YUM (Yellowdog Updater Modified)
YUM is a high-level package manager that wraps RPM and handles dependencies automatically.
YUM Commands:
# Install
sudo yum install httpd -y
# Remove
sudo yum remove httpd
# Update one package
sudo yum update telnet
# Update all packages
sudo yum update
# List repositories
yum repolist
# Check package for a command
yum provides scp
Repository Location:
/etc/yum.repos.d/*.repo
๐ข DPKG (Debian Package Manager)
DPKG is the low-level tool for .deb
packages.
Common Commands:
# Install a package
sudo dpkg -i package.deb
# Remove a package
sudo dpkg -r package-name
# List installed packages
dpkg -l
# Show package status
dpkg -s package-name
โ Limitation:
No dependency management โ installs fail if dependencies are missing.
๐ต APT (Advanced Package Tool)
APT is a high-level tool for Debian-based systems that resolves dependencies automatically.
APT Commands:
# Update repo index
sudo apt update
# Upgrade all packages
sudo apt upgrade
# Install a package
sudo apt install gimp
# Remove a package
sudo apt remove gimp
# Search a package
apt search telnet
Repository File:
/etc/apt/sources.list
โ๏ธ APT vs APT-GET
Feature | apt | apt-get |
User-friendly | โ Yes | โ No (minimal output) |
Default in modern distros | โ Installed | โ Installed |
Progress bar | โ Yes | โ No |
Command simplicity | โ
Yes (apt search ) | โ Uses apt-cache |
๐ Final Thoughts
Use RPM + YUM on RHEL/CentOS
Use DPKG + APT on Ubuntu/Debian
Prefer high-level tools (
yum
,apt
) for easier dependency handlingKnow the config files:
/etc/yum.repos.d/
,/etc/apt/sources.list
๐ง Advanced Tips
โ
Using yum history
to track package operations
# View YUM transaction history
yum history
# Undo a transaction (e.g., ID 15)
yum history undo 15
โ Cleaning up unused packages and cache
# Remove old/unused packages
sudo yum autoremove
# Clean up YUM cache
sudo yum clean all
# Clean up APT cache
sudo apt autoremove
sudo apt clean
โ Simulating package installation (dry-run)
# Simulate with APT (dry-run)
sudo apt install <package-name> --dry-run
# With YUM (dry-run equivalent using --assumeno)
sudo yum install <package-name> --assumeno
โ Lock a package version (APT-based)
# Prevent a package from upgrading
sudo apt-mark hold <package-name>
# Remove the lock
sudo apt-mark unhold <package-name>
โ Find which package owns a file
# RPM-based
rpm -qf /bin/ls
# APT-based
dpkg -S /bin/ls
Subscribe to my newsletter
Read articles from Vignesh M directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Vignesh M
Vignesh M
๐ ๏ธ DevOps Engineer in Progress | ๐ Documenting my #150DaysOfDevOps journey | ๐ก Passionate about Linux, Cloud & Automation | ๐ Sharing what I learn every day