.repo files, and best practices for secure package management.
Most software on RHEL 10 is distributed as RPMs and managed with the DNF package manager. Historically administrators used YUM, but on modern systems like RHEL 10, DNF is the standard tool.




- Use Red Hat Subscription Manager to register and auto-attach subscriptions:
Avoid passing passwords on the command line on multi-user systems—commands and arguments may appear in process listings. Omit
--password to be prompted interactively.- Show enabled repositories:
- Get verbose repository details (includes base URLs):
- Show all repositories, including disabled ones:
- Inspect repository metadata/details:
Understanding repository configuration files
Repository definitions are stored in/etc/yum.repos.d. Although DNF is the package manager, the historical directory name is preserved for compatibility. Each repository file must end in .repo and uses INI-style stanzas.
Use the table below to quickly reference common .repo fields:
Example: a concise Docker CE repository configuration
gpgcheck=1) confirms packages are signed by the provider and have not been tampered with. For development or internal test repositories you may set gpgcheck=0, but avoid disabling signature verification on production systems.
Creating and using a custom repository — step-by-step
Typical workflow when adding a new repository manually:- Create a file under
/etc/yum.repos.dthat ends with.repo. - Add a repository stanza with an ID,
name,baseurl,enabledflag, and GPG settings. - Refresh DNF metadata and cache.
- Verify the repository appears in
dnf repolistand list packages available from that repo. - Install a package from the repository to validate it works.
.repo file, refresh metadata and cache:
rocky-baseos:
zsh):
Enabling and disabling repositories without editing files
Disable a repo temporarily with DNF config-manager:.repo file or by removing the specific stanza from the file.
Best practices and callouts
Always enable
gpgcheck=1 and provide a valid gpgkey for production repositories to ensure package integrity. For test or internal repositories you may temporarily set gpgcheck=0, but never do so on production hosts.When using RHEL, prefer
subscription-manager to enable official Red Hat repositories. Use dnf config-manager or .repo files in /etc/yum.repos.d/ for third‑party or local repositories.Summary and quick reference
You should now be able to:- Register a RHEL system to access official repositories using
subscription-manager. - List enabled and all repositories with
dnf repolistand inspect metadata withdnf repoinfo. - Create and edit
.repofiles in/etc/yum.repos.d. - Refresh DNF metadata with
dnf clean allanddnf makecache. - Enable/disable repos with
subscription-managerordnf config-manager. - Install packages from custom repositories and verify their source with
dnf list --repoand transaction output.
- Red Hat Subscription Manager documentation: https://access.redhat.com/documentation/en-us/red_hat_subscription_management/
- DNF documentation and man page: https://dnf.readthedocs.io/ and
man dnf - Creating custom YUM/DNF repositories (examples and best practices): https://access.redhat.com/articles/what-is-yum-mirror-management