How are repositories and their GPG keys configured?
AdvancedConceptPackages, Shell & Text Tools
Answer
Debian/Ubuntu: a .list or deb822 .sources file in /etc/apt/sources.list.d/ with the key stored in /etc/apt/keyrings/ and referenced by signed-by= (the old apt-key is deprecated).
curl -fsSL https://example.com/key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/example.gpg
echo "deb [signed-by=/etc/apt/keyrings/example.gpg] https://example.com/apt stable main" | sudo tee /etc/apt/sources.list.d/example.list
RHEL: a .repo file in /etc/yum.repos.d/ with gpgcheck=1 and gpgkey=. Scoping a key with signed-by stops one repo's key from signing packages for every repo.
More on Packages, Shell & Text Tools
Compare apt and dnf package management.BeginnerWhat is the difference between `apt upgrade` and `apt full-upgrade`?IntermediateHow do you find which package provides a file or command?BeginnerHow do you pin or hold a package version?IntermediateWhat is the difference between a login shell and an interactive non-login shell?IntermediateWhat does `set -euo pipefail` do in a bash script?Intermediate