Different Linux distributions use different package managers. Understanding them is crucial for system administration.
Debian/Ubuntu: apt
apt update # Update package lists
apt upgrade # Upgrade all packages
apt install package # Install package
apt remove package # Remove package
apt search keyword # Search for packages
apt show package # Show package info
Red Hat/CentOS: yum/dnf
dnf update # Update packages
dnf install package # Install package
dnf remove package # Remove package
dnf search keyword # Search
dnf info package # Package information
Arch Linux: pacman
pacman -Syu # Sync and upgrade
pacman -S package # Install
pacman -R package # Remove
pacman -Ss keyword # Search
pacman -Qi package # Info
Building from Source
Sometimes you need to compile software:
./configure
make
sudo make install
Snap and Flatpak
Universal package formats:
# Snap
snap install package
snap list
# Flatpak
flatpak install package
flatpak list
Best Practices
- Always update package lists before installing
- Use version pinning for production systems
- Keep systems updated for security
- Understand dependencies before removing packages
Package management is a core skill for maintaining Linux systems.