After this lesson, you will be able to: Install, remove, and keep packages updated using apt (Debian/Ubuntu) and dnf/yum (Red Hat/Fedora).
Every Linux server needs software installed and kept current. Package managers handle that; knowing yours is mandatory.
The most-used package manager. Memorise these commands.
sudo apt update # refresh package indexsudo apt upgrade # upgrade installed packagessudo apt install nginx # install a packagesudo apt install -y nginx jq curl # multiple at once, no promptsudo apt remove nginx # remove (leaves config)sudo apt purge nginx # remove + configsudo apt autoremove # clean up orphaned depsapt show nginx # info about a packageapt list --installed # everything installedapt search 'web server' # find packages
Same shape, different syntax. yum is the older name; dnf is the modern version.
sudo dnf check-update # see what's availablesudo dnf upgrade # upgrade allsudo dnf install nginxsudo dnf remove nginxsudo dnf info nginxsudo dnf search 'web server'# On older systems / Amazon Linux 1:sudo yum install nginx # interchangeable with dnf
Security patches publish daily. Manual `apt update` cadence fails. Ubuntu: install `unattended-upgrades` and enable security upgrades automatically. Red Hat: `dnf-automatic.timer`. Both apply security patches without rebooting (except kernel updates, which need a reboot, see `needrestart` to detect).
Running `apt upgrade` on a production server without testing in staging. Sometimes a config-file prompt or a service restart breaks things. Mixing language package managers (apt's `python3-django` and pip's `Django`). They conflict; pick one per project. Forgetting `apt update` before `apt install`. Without it, you install whatever the local cache last saw, possibly months old. Installing third-party `.deb` files without checking signatures. Always prefer official apt repos.
Pick the concise answer.
Sign in and purchase access to unlock this lesson.