Sub topic 1
Keeping a Linux Server Patched with apt and dnf
Prerequisites
You should be comfortable with a Linux shell and sudo, know what a package is, and have SSH access to a Debian, Ubuntu, or RHEL-family test machine.
Why patch, and what a patch routine must balance
Unpatched software carries known bugs and security flaws. A patch routine balances three things: applying security fixes quickly, keeping running services stable, and making changes at predictable times. Patching too rarely leaves known holes open. Patching without testing can break applications that depend on a specific library version.
How apt and dnf relate to dpkg and rpm
dpkg (Debian and Ubuntu) and rpm (RHEL-family) are low-level tools. They install, remove, and query single package files, called .deb and .rpm files. They do not fetch packages from the network or resolve dependencies between packages.
apt and dnf sit on top of these tools. They download packages, resolve dependencies, and then pass the work to dpkg or rpm.
Repositories and signature verification
A repository is a server that hosts packages and an index that describes them. apt reads its sources from /etc/apt/sources.list and files in /etc/apt/sources.list.d/. dnf reads .repo files in /etc/yum.repos.d/.
Official repositories sign their metadata with a GPG key. The package manager checks that signature before it trusts the index. If the check fails, the tool refuses the update. Do not disable signature checks to get past an error. Import the vendor key or fix the repository definition instead.
Refreshing metadata before you look at updates
Package managers keep a local cache of each repository's index. If the cache is old, you see old versions and miss recent fixes. Refresh the cache first:
# Debian and Ubuntu
sudo apt update
# RHEL-family
sudo dnf makecacheBoth commands download new indexes only. They do not install anything.
Exercise
Why should you run sudo apt update before sudo apt upgrade?
Show answer
apt upgrade works from the local cache. Without a refresh, it installs the versions listed in the last cache update and can miss security fixes published since then.