Package Management in Linux
DevOps engineer sharing daily learnings on Linux, Docker, Kubernetes, CI/CD, and Cloud.
What is package management?
Package management is the process of:
Installing software
Updating packages
Removing applications
Managing dependencies
In Linux, software is distributed as packages and handled by package managers.
π A package contains:
Application binaries
Configuration files
Dependencies
Metadata (version, description)
Role of package manager :
Without package managers:
Youβd manually download software
Resolve dependencies yourself
Risk breaking the system
Package managers:
Automatically handle dependencies
Fetch software from trusted repositories
Keep systems secure and updated
Types of Linux Packages
| Package Type | Distributions |
.deb | Ubuntu, Debian |
.rpm | RHEL, CentOS, Rocky, Alma |
.apk | Alpine Linux |
Popular Linux Package Managers used in day to day activities :
- π¦
apt(Debian / Ubuntu) :
Used in Debian-based systems
Works with
.debpackages
Common commands :
sudo apt update
sudo apt install nginx
sudo apt remove nginx
sudo apt upgrade
- π¦
yum(Older RHEL / CentOS) :
Used in older RHEL-based systems
Handles
.rpmpackages
Common commands :
sudo yum install httpd
sudo yum remove httpd
dnf(Modern RHEL / Fedora) :
Successor to
yumFaster and better dependency handling
sudo dnf install httpd
sudo dnf update
- π¦
apk(Alpine Linux) :
Lightweight package manager
Common in Docker containers
apk add curl
apk del curl
Repositories :
Repositories are trusted software sources that Linux uses to install and update packages automatically.
A repository is a storage location where Linux packages are kept
Package managers download software from repositories, not random websites
Repositories contain:
Software packages
Version information
Dependency details
Security updates
π This ensures safe, verified, and consistent software installation
π Always prefer official repositories for security.
Example :
/etc/apt/sources.list
/etc/yum.repos.d/
π Package Management Workflow
Package management in Linux follows a standard step-by-step workflow:
Update Package Index :
The system fetches the latest package information from repositories.
apt update #Ubuntu dnf makecache #RHELSearch for a Package :
Find available software in repositories.
apt search nginx #Ubuntu dnf search nginx #RHELInstall the Package
Download and install the package along with its dependencies.
apt install nginx #Ubuntu dnf install nginx #RHELUse / Configure the Software
Start the service or edit configuration files as needed.
Update Installed Packages
Keep software secure and up to date.
apt upgrade #Ubuntu dnf update #RHELRemove the Package (If Needed)
Uninstall software cleanly.
apt remove nginx #Ubuntu dnf remove nginx #RHELLinux package managers fetch β install β update β remove software automatically while handling dependencies for you.
Common Beginner Mistakes β οΈ
Forgetting
apt updateMixing package managers
Installing from untrusted sources
Removing system-critical packages
π Conclusion
Package management makes Linux:
Stable
Secure
Easy to maintain
Understanding package managers is essential for Linux admins and DevOps engineers.