Nobody hunts for archives by hand: repositories hand them out, and lists of what they contain are kept on the machine.
A repository is a server with package archives. Ubuntu takes packages from its own repositories, and their addresses are written in the APT settings.
There is no need to download archives just to get a list: the machine keeps indexes — lists of packages and versions for each repository. Their copy lives in /var/lib/apt/lists. apt installs a package by name: it finds it in the indexes, downloads the archive together with its dependencies and hands it to dpkg. apt and dpkg change the system as root: without sudo, apt install prints Could not open lock file /var/lib/dpkg/lock-frontend and asks are you root?.
sudo apt update downloads fresh indexes. It does not change installed programs — sudo apt upgrade upgrades those. The training machine has no network: apt update prints Temporary failure resolving 'archive.ubuntu.com' and keeps the old indexes.
What does sudo apt update change on a machine with a network?
-
apt upgradeupgrades installed packages. Afterapt updatetheInstalledline ofapt-cache policyshows the same version. -
apt downloads an archive when it installs a package.
apt updatefetches only the lists, which live in/var/lib/apt/lists.
apt update refreshes the indexes, and afterwards apt-cache policy may show a new candidate. A separate command, apt upgrade, installs new versions.
Key points
- A repository hands out archives; the indexes on the machine list its packages and versions.
-
apt updaterefreshes the indexes,apt upgradethe installed packages. -
aptinstalls by name from the indexes, dpkg from an archive on disk.