Interview Prep/Linux/Packages, Shell & Text Tools

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.

All Linux questions Roadmap: Linux

More on Packages, Shell & Text Tools