What is a Linux package repository?
Where do APT and DNF get the software you ask them to install? They get it from package repositories. Knowing which repositories your system uses helps you find out which versions and security updates are available.
Read the package index, then download the packages
A repository holds software packages and metadata that describes them, including names, versions, and dependencies. For example, apt update fetches the package index. When you later run apt install curl, APT uses the index to select an installable version and download any required dependencies. APT manual
Compare official repositories, third-party repositories, and mirrors
Who publishes the packages and updates?
The distribution publishes packages in its official repositories. A third-party repository has a different publisher, such as the developer of an application. Check that publisher’s advisories and supported OS releases for its packages. A mirror serves a copy of a repository from another server. It can briefly lag behind while it synchronizes. Debian mirrors and DNF repository configuration
Check the publisher and signature when adding a source
Adding a repository allows your package manager to get software from that publisher in the future. If you need to add one, use the publisher’s official instructions to check the supported OS release and signing key. APT, for example, uses repository signatures and recorded hashes to verify what it downloads. Consider whether you trust the publisher to provide updates as well. APT signature verification
Check which repositories your system uses
You can inspect candidate versions and repository lists without editing the configuration. APT reads an index it already fetched, so take into account when that index was last refreshed.
Repository queries by package manager
apt-cache, DNF, DNF5, and pacman-conf
| Tool | Query | What it shows |
|---|---|---|
| APT | apt-cache policy curl |
Installed version, candidate version, and sources for curl |
| DNF | dnf repolist (dnf5 repo list for DNF5) |
Enabled repositories |
| pacman | pacman-conf --repo-list |
Names of configured repositories |