LPIC-1 Linux Installation and Package Management Practice Question
A technician is tasked with installing a package from a third-party repository on a CentOS 7 system. What is the correct first step to add the repository?
⚠ Common exam trap
Many candidates confuse editing /etc/yum.conf (which is for global yum options, not repository definitions) with the correct method of adding a .repo file, or they assume 'yum localinstall' can add a repository when it only installs a single package.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Create a .repo file in /etc/yum.repos.d/.
On CentOS 7, third-party repositories are added by placing a .repo file in /etc/yum.repos.d/. This file defines the repository ID, name, baseurl, and GPG check settings. Yum reads all .repo files in this directory at runtime, making it the standard and correct first step for adding a repository.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Run 'yum localinstall' with the repository URL.
Why it's wrong here
yum localinstall installs a local RPM file, not a repository definition, so it cannot register a third-party repo. It is tempting because it accepts a URL and resolves dependencies, making it the correct tool for installing a downloaded RPM package rather than adding a repository.
- ✓
Create a .repo file in /etc/yum.repos.d/.
Why this is correct
CentOS 7 uses YUM/DNF, which reads repository definitions from .repo files under /etc/yum.repos.d/. Creating that file with the repository's baseurl and GPG settings registers the third-party source, making its packages installable. This is the prerequisite before any install command.
- ✗
Edit /etc/yum.conf and add the repository URL.
Why it's wrong here
/etc/yum.conf holds global Yum settings, not per-repository definitions; repository stanzas belong in /etc/yum.repos.d/*.repo files. Editing yum.conf would be correct for global options such as proxy, cachedir or gpgcheck defaults, not for adding a third-party repository.
- ✗
Use 'yum-config-manager --add-repo' without any further steps.
Why it's wrong here
Adding a repo with yum-config-manager alone leaves its GPG key unimported, so package signature verification fails on CentOS 7. It is tempting because that command does register the repository definition, which is the right move when the repo's key is already trusted or gpgcheck is disabled.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LPIC-1 question from scratch — 402 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LPIC-1 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-1 exam.