0 / 15 lessons — 0%
Lesson 04 / 15

Package management

Installing software by hand (downloading a tarball, compiling it, hoping the dependencies line up) is exactly the tedious, error-prone work a package manager exists to remove. Which one you use depends entirely on the distro family.

Distro familyPackage managerPackage format
Debian, Ubuntuapt.deb
RHEL, Fedora, Rocky, Almadnf (or older yum).rpm
# Debian/Ubuntu sudo apt update # refresh the package index — always do this first sudo apt install nginx sudo apt remove nginx sudo apt upgrade # upgrade everything installed apt search postgres apt list --installed
# RHEL/Fedora sudo dnf install nginx sudo dnf remove nginx sudo dnf update dnf search postgres dnf list installed

The pattern is nearly identical between the two — install, remove, an update-everything command, and a search. Learn one and the other one is mostly a vocabulary swap.

"apt update" and "apt upgrade" are not the same thing, despite the similar names. update refreshes the local list of what's available; upgrade actually installs newer versions of what's already on the box. Running upgrade alone against a stale index silently does nothing useful.
Try it yourselfRun apt list --installed | wc -l (or dnf list installed | wc -l) — the number of packages already on a "minimal" server install is usually bigger than people guess.