The .repo File Format

Chapter 6
Managing Repositories on RedHat-Based Systems
.repo files, enabling/disabling repositories, and EPEL — the RPM world's most important third-party repository

Chapter 3 covered apt's repository system in depth. This chapter covers the RPM-world equivalent — structurally similar in purpose, genuinely different in file format and conventions.

The .repo File Format

$ cat /etc/yum.repos.d/fedora.repo
[fedora]
name=Fedora $releasever - $basearch
baseurl=https://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
[fedora]
The repository's ID — an INI-style section header, used to reference this specific repo in other commands
baseurl
Where to actually fetch packages from — equivalent to apt's repository URL
enabled
1 or 0 — whether dnf actually uses this repository at all
gpgcheck + gpgkey
The RPM-world equivalent of apt's signature verification (Chapter 3) — should essentially always be enabled
$releasever and $basearch are genuinely convenient variables
These placeholders automatically resolve to the actual OS version and CPU architecture at runtime — the same repo file works correctly across different Fedora versions or CPU architectures without needing separate, hand-edited files for each.

Enabling and Disabling Repositories

$ # List all configured repositories and their enabled/disabled state
$ dnf repolist all

$ # Temporarily disable a repo for one specific command
$ sudo dnf install nginx --disablerepo=fedora-updates-testing

$ # Permanently enable/disable a repo
$ sudo dnf config-manager --set-enabled fedora-updates-testing
$ sudo dnf config-manager --set-disabled fedora-updates-testing

EPEL — Extra Packages for Enterprise Linux

EPEL is the single most important third-party repository in the RHEL-compatible world — a community-maintained collection of additional packages, filling gaps in RHEL/Rocky/Alma's deliberately conservative default package set, broadly analogous in role and reputation to Debian's contrib component or a well-trusted PPA.

$ # Installing EPEL on RHEL/Rocky/Alma
$ sudo dnf install epel-release
$ sudo dnf update
EPEL itself is just installed as a regular package, not configured by hand
Rather than manually writing a .repo file and importing a signing key (the manual process Chapter 3 covered for apt), EPEL ships as its own package that, once installed, sets up its own repository configuration and trusted key automatically — about as close to a one-command setup as third-party repositories get in this whole course.

Adding a Generic Third-Party Repository Manually

$ # Many vendors provide a one-liner to add their own .repo file directly
$ sudo dnf config-manager --add-repo https://example.com/myrepo.repo

$ # Or manually create the file with the structure shown earlier in this chapter
$ sudo nano /etc/yum.repos.d/myrepo.repo
The same trust principle from Chapter 3 applies identically here
Adding any third-party RPM repository means trusting that maintainer's packages run with root privileges during installation — exactly the same risk covered for apt's third-party repos. Stick to well-known, widely-trusted sources like EPEL, and verify gpgcheck=1 is actually set for anything else added.
CommandWhat it does
dnf repolist allLists every configured repo and its enabled state
dnf config-manager --set-enabled/--set-disabledPermanently toggles a repo on or off
dnf install epel-releaseInstalls and auto-configures the EPEL repository
dnf config-manager --add-repo <url>Adds a .repo file from a URL directly

Chapter 6 Quick Reference

  • .repo files in /etc/yum.repos.d/ — INI-style, with [id], baseurl, enabled, gpgcheck/gpgkey fields
  • $releasever/$basearch — variables resolved automatically, making one repo file work across versions/architectures
  • dnf repolist all — see every configured repo and its state
  • dnf config-manager --set-enabled/--set-disabled — permanently toggle a repo
  • EPEL — the most important third-party repo in the RHEL world; installs and configures itself via one package
  • Same trust principle as apt's third-party repos — only add sources genuinely trusted, verify gpgcheck is enabled
  • Next chapter: rpm deep dive — querying, verifying, manual package operations