LPIC-1 Linux Installation and Package Management Practice Question
An openSUSE administrator needs to add a new repository from a URL and refresh the package cache. Which command sequence accomplishes this?
⚠ Common exam trap
A common mix-up: candidates confuse `zypper` with `apt` or `yum` commands, where `add-apt-repository` or `yum-config-manager --add-repo` combine adding and refreshing in one step, but `zypper` requires two separate commands.
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
✓
zypper addrepo url; zypper refresh
`zypper addrepo url` adds a new repository from the specified URL, and `zypper refresh` updates the package cache to include metadata from all configured repositories. This two-step sequence is the standard method in openSUSE for adding a remote repository and making its packages available for installation.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
zypper install --repo url
Why it's wrong here
install --repo restricts installation to packages from a named repository; it neither registers the URL nor refreshes metadata, so the repository is never added. It tempts because --repo is genuinely useful for pinning a package install to one already-configured repository.
- ✓
zypper addrepo url; zypper refresh
Why this is correct
zypper addrepo registers the URL as a new repository in the openSUSE configuration, then zypper refresh rebuilds the package metadata cache so the new source's packages become installable. Both steps are required to satisfy the stem's add-and-refresh constraint.
- ✗
zypper modifyrepo --add url
Why it's wrong here
modifyrepo alters settings of an already-registered repository, such as enabling or renaming it; it cannot register a new URL, so the add fails. It tempts because modifyrepo is the correct subcommand when changing properties of an existing repository rather than introducing a fresh one.
- ✗
zypper repos --add url
Why it's wrong here
zypper repos lists and modifies existing repository definitions; --add is not a valid flag for it, so no repository is created. It tempts because repos is the subcommand administrators inspect when auditing configured repositories, which is the right tool for viewing rather than adding a new URL.
Go deeper
Related to this question
About these practice questions
One of 402 original LPIC-1 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.