Frequently Asked Question

What is a repository and how does the package manager use it?

A repository is a server (or a set of mirrors) that hosts a curated collection of packages together with index files describing what is available, at which version, with which dependencies, and a cryptographic signature over those indices. Your package manager keeps a list of repositories it trusts; when you run apt update, dnf check-update, or pacman -Sy, it fetches the latest index from each one and stores it locally in /var/lib/apt, /var/cache/dnf, or similar.

Once those indices are local, apt install nginx does not need to ask the repository whether nginx exists, it can resolve the entire dependency graph offline, then download only the .deb or .rpm files actually needed. The repository is therefore both a catalogue (the indices) and a warehouse (the packages themselves), and the package manager's job is to keep your local view of the catalogue in sync with the warehouse.

Further reading and video