6.1 Configure Access to RPM Repositories
Key Takeaways
- DNF is the package manager on RHEL 10; repository definitions live as *.repo files under /etc/yum.repos.d/ (global options in /etc/dnf/dnf.conf).
- A valid .repo stanza needs a unique [repo-id], name, and a baseurl or metalink/mirrorlist; enabled=1 and gpgcheck settings control use and trust.
- Use dnf repolist, dnf config-manager, and dnf makecache to verify repositories before installing packages.
- Local file://, HTTP/HTTPS, and CDN/subscription-backed repos all appear the same to DNF once .repo files are correct—exam tasks often add a custom or local repo.
- Repository configuration is file-based and persists after reboot; a bad enabled/gpgcheck value fails later install tasks silently or loudly.
6.1 Configure Access to RPM Repositories
Quick Answer: On RHEL 10, define RPM package sources in
/etc/yum.repos.d/*.repo(not hand-stacked only in memory). Each repo needs a unique[id],name=, andbaseurl=ormetalink=/mirrorlist=, plusenabled=and GPG settings. Confirm withdnf repolistanddnf makecache. Configs on disk persist after reboot—required for EX200 credit.
Why repository access is its own exam skill
The official EX200 study points split Manage software into repository access and package install/remove for both RPM and Flatpak. Graders do not care that you memorized dnf install if the system has no usable repo. Typical tasks:
- Add a custom or local repository (directory tree with
repodata/) - Point DNF at an HTTP/HTTPS mirror or training server
- Enable/disable an existing repo
- Fix a broken
.reposo packages install again
If the repo is wrong, every later software task fails. Treat this section as the foundation for Section 6.2.
DNF vs yum naming (RHEL 10)
RHEL uses DNF as the package manager stack. The classic yum command remains a familiar front end on many systems (often a compatibility path to DNF). Prefer dnf in modern documentation and on the exam unless a task literally says yum.
Important paths still use the historical yum directory name:
| Path | Role |
|---|---|
/etc/dnf/dnf.conf | Global DNF configuration ([main]): cache, gpgcheck defaults, plugins, etc. |
/etc/yum.repos.d/ | Directory of individual *.repo files—primary place to define repositories |
/var/cache/dnf/ | Downloaded metadata and packages (cache) |
Red Hat’s guidance: define repositories in .repo files under /etc/yum.repos.d/, not by stuffing long-lived repo stanzas only into dnf.conf. Keep dnf.conf for global policy; keep repos modular and easy to enable/disable.
Anatomy of a .repo file
Files must end in .repo or DNF ignores them. One file may contain multiple repository sections.
[exam-appstream]
name=Exam AppStream mirror
baseurl=https://repo.example.com/rhel10/AppStream/x86_64/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
| Directive | Meaning |
|---|---|
[exam-appstream] | Repository ID (unique). Used in dnf --enablerepo=exam-appstream and repolist |
name= | Human-readable description |
baseurl= | Direct URL or path to the repo root (must contain or resolve to repodata/) |
metalink= / mirrorlist= | Dynamic mirror selection instead of a single baseurl |
enabled=1 or 0 | Whether DNF uses the repo by default |
gpgcheck=1 or 0 | Verify package signatures when installing |
gpgkey= | URL or file:// path to the public key |
module_hotfixes= / other options | Advanced; only set when documentation or task requires |
Local file repository (common lab/exam pattern)
If packages and metadata live on disk (ISO mount, NFS share, copied tree):
[local-baseos]
name=Local BaseOS
baseurl=file:///mnt/iso/BaseOS
enabled=1
gpgcheck=0
Notes:
file://URLs need three slashes for absolute paths:file:///mnt/iso/BaseOS.- The path must be the repository root that contains
repodata/(or the correct relative structure for that product tree). - Training labs sometimes set
gpgcheck=0for unsigned local trees. Prefergpgcheck=1with a propergpgkeywhen keys are provided—match the task.
HTTP/HTTPS remote repository
[training-extra]
name=Training Extra Packages
baseurl=http://materials.example.lab/rhel10/extra/
enabled=1
gpgcheck=1
gpgkey=http://materials.example.lab/RPM-GPG-KEY-training
On a real RHEL system attached to Red Hat CDN, BaseOS/AppStream repos are usually provisioned via subscription-manager content and vendor .repo files. Exam environments may preconfigure CDN access or give you a local/training URL instead—always follow the task wording.
Creating and editing repository definitions
Manual file creation
sudo vim /etc/yum.repos.d/exam-local.repo
# or
sudo tee /etc/yum.repos.d/exam-local.repo <<'EOF'
[exam-local]
name=Exam Local Repo
baseurl=file:///var/www/html/repo
enabled=1
gpgcheck=0
EOF
Permissions: world-readable config is normal; root must own the file. Wrong ownership is rarely the issue—typos in baseurl and missing repodata are.
dnf config-manager (when available)
Many RHEL systems provide dnf config-manager (from dnf-plugins-core) to add or toggle repos without hand-editing:
# Add a repo from a URL (creates a .repo file; often enabled by default)
sudo dnf config-manager --add-repo=https://example.com/my.repo
# or
sudo dnf config-manager --add-repo=http://server.lab/rhel10/
# Enable / disable by repo id
sudo dnf config-manager --set-enabled exam-local
sudo dnf config-manager --set-disabled exam-local
If the plugin is missing in a constrained lab, fall back to editing /etc/yum.repos.d/ directly—the exam grades end state, not which editor you used.
Importing a GPG key
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
# or from a file the task provides
sudo rpm --import /tmp/RPM-GPG-KEY-training
Keys under /etc/pki/rpm-gpg/ are the usual Red Hat locations. After import, gpgkey=file:///etc/pki/rpm-gpg/... in the .repo file can succeed during install.
Verifying repository access
Never assume a .repo file works. Verify:
# List enabled repositories
dnf repolist
# List all (enabled and disabled)
dnf repolist --all
# Verbose detail including URLs
dnf repolist -v
# Refresh metadata (forces contact with baseurl/metalink)
sudo dnf makecache
# or
sudo dnf clean all
sudo dnf makecache
Success looks like your new repo id appearing in dnf repolist and makecache completing without “Error: Failed to download metadata” or 404-style failures.
Useful inspections:
ls /etc/yum.repos.d/
grep -R "^\[" /etc/yum.repos.d/
cat /etc/dnf/dnf.conf
dnf config-manager --dump # if plugin present; dumps effective config
Troubleshooting map
| Symptom | Likely cause | Fix approach |
|---|---|---|
Repo missing from repolist | enabled=0 or file not named *.repo | Set enabled=1; rename file |
| Metadata download failed | Wrong baseurl, network, or no repodata | Fix URL; curl/browse path; mount ISO |
| GPG errors on install | Missing key or gpgcheck=1 without key | Import key or set correct gpgkey= |
| SSL certificate errors | HTTPS MITM/lab CA issues | Use HTTP if task allows, or install CA |
| Duplicate repo ids | Two sections with same [id] | Make ids unique |
Temporary enable/disable without editing files
For a single transaction:
sudo dnf install --enablerepo=exam-local httpd
sudo dnf install --disablerepo="*" --enablerepo=exam-local somepkg
Exam persistence note: --enablerepo on one command does not permanently enable the repo. If the task says “configure the system to use this repository,” edit the .repo (enabled=1) or use config-manager --set-enabled. Runtime-only flags vanish after the shell session—and after reboot the permanent file state is what matters.
Red Hat content layout (conceptual)
Production RHEL 10 systems commonly expose at least:
- BaseOS — core OS packages
- AppStream — user-space applications, runtimes, databases, etc.
You do not need to memorize every RHSM product name for EX200, but you must recognize that multiple repos may be required for a complete package set. Disabling AppStream while installing a desktop or language stack often causes “No match for argument” failures that look like missing packages but are really disabled sources.
Exam workflow: “Add a repository and prove it”
- Read the task for URL/path, repo id requirements, GPG expectations, and enable state.
- Create
/etc/yum.repos.d/<descriptive>.repowith correctbaseurl/metalink. - Import GPG keys if provided.
- Run
dnf repolistanddnf makecache. - Optionally search for a known package from that repo (
dnf search/dnf list) without installing yet if the task only asks for access. - Reboot if you have time (or at least re-open a new session) and confirm
/etc/yum.repos.d/content anddnf repoliststill show the repo—file-based config should persist; prove it.
Common traps
- Writing
baseurl=file://mnt/iso(two slashes afterfile:for absolute path misuse) — usefile:///mnt/iso/.... - Pointing
baseurlat the ISO file instead of the mounted directory tree containingrepodata. - Leaving
enabled=0after creating a perfect file. - Assuming
dnf.confalone is enough while forgetting/etc/yum.repos.d/. - Using spaces or invalid characters carelessly in repo ids — keep ids simple: letters, numbers, hyphens, underscores.
- Fixing only the client when the server path 404s — verify the remote path with
curl -Iwhen network tools are available.
Relationship to later objectives
Section 6.2 assumes repositories work. Chapter objectives on install/update from CDN, remote repo, or local filesystem reuse these same .repo skills. Flatpak (6.3–6.4) is a parallel application distribution system—it does not replace DNF for system RPMs (kernel, httpd, firewalld, etc.).
Section checkpoint
You should be able to create a correct *.repo file, enable or disable repos permanently, import GPG keys, refresh metadata, list available repositories, and leave a configuration that still works after reboot. That is the EX200 definition of “configure access to RPM repositories.”
Where should you primarily define additional RPM repositories for DNF on RHEL 10?
A new repository file exists but dnf repolist never shows it. Which cause is most likely?
Which baseurl correctly references a repository rooted at the absolute path /mnt/disc/BaseOS?
A task says the system must use a training repository for all future installs. You successfully install one package with dnf install --enablerepo=train pkg. What is still missing for full credit after reboot?