CompTIA Linux+ (XK0-006)System ManagementHard
An administrator manages both a Debian-based server and a Fedora-based server. On the Fedora server, the administrator needs to add a trusted third-party software repository so 'dnf install' can pull packages from it. Where should the repository definition be placed?
- AAn entry in /etc/hosts pointing to the repository server
- BA new line added to /etc/apt/sources.list
- CA new .repo file in /etc/yum.repos.d/
- DA new file in /etc/dnf/plugins/
Show answer & explanationAnswer & explanation
Correct answer: C. A new .repo file in /etc/yum.repos.d/
DNF (and its predecessor YUM) reads repository definitions from .repo files stored in /etc/yum.repos.d/, each containing details like baseurl, gpgkey, and enabled status. /etc/apt/sources.list is the Debian/Ubuntu equivalent used by APT, not DNF.
Why the other options are wrong
- A. /etc/hosts maps hostnames to IPs and has no role in repository configuration.
- B. sources.list is used by APT on Debian-based systems, not DNF on Fedora.
- D. /etc/dnf/plugins/ holds DNF plugin configurations, not repository definitions.
DNF Repository Configuration
DNF reads repository definitions from .repo files in /etc/yum.repos.d/, each specifying baseurl, gpgcheck, and enabled settings.
- File extension is .repo
- Equivalent APT location is /etc/apt/sources.list(.d/)
- GPG key verification is controlled by gpgcheck=1 and gpgkey= directives
Memory trick: yum.repos.d = 'the yellow pages' DNF checks to find its software stores