A repository is a collection of packages stored on a server, together with an index that describes them. Your package manager reads the index, finds what you asked for, and downloads it.
What is in a repository
The index lists every package with its version, dependencies, size and checksum. Your system keeps a local copy of that index. When new versions appear on the server, your copy does not change until you refresh it. On Debian and Ubuntu:
$ sudo apt update
Hit:1 http://deb.debian.org/debian bookworm InRelease
Reading package lists... Doneapt update only refreshes the index. It does not upgrade any installed program. dnf on Fedora and Red Hat systems refreshes its metadata automatically when it is old, and sudo dnf makecache downloads it ahead of time.
Where apt looks
APT reads its sources from /etc/apt/sources.list and from files in /etc/apt/sources.list.d/. A traditional one-line entry looks like this:
deb http://deb.debian.org/debian bookworm mainThe parts are the type (deb for binary packages), the server address, the suite or release, and one or more components. Newer releases may instead use .sources files with named fields such as Types:, URIs:, Suites: and Components:.
Where dnf and yum look
On RPM systems that use dnf or yum, each repository is described in a .repo file under /etc/yum.repos.d/:
[example]
name=Example repository
baseurl=https://repo.example.com/el9/
enabled=1
gpgcheck=1
gpgkey=https://repo.example.com/key.ascYou can list the active ones with dnf repolist. openSUSE uses zypper, which has its own directory, /etc/zypp/repos.d/.
Signatures and trust
Repositories are normally signed with a GPG key. Your system holds the matching public key and checks the signature, so a changed or fake package is rejected.
A repository can install files as root and run scripts as root. Adding one means trusting its owner with your whole machine. Add third-party repositories only when you have a good reason, follow the vendor's official instructions, and never switch off signature checking just to silence an error.
A mirror is a copy of a repository on another server. Mirrors spread the load and can be closer to you. The signatures still apply.
Try it
Look at your configured sources without changing anything:
$ ls /etc/apt/sources.list.d/ # Debian, Ubuntu
$ ls /etc/yum.repos.d/ # Fedora, RHEL
$ dnf repolist # Fedora, RHELPick one entry and identify its server address and release. The packages, disk and FHS lab gives you a shell to practise in.
Check your understanding
Package Repositories
All 4 sections ยท no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.