DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
Blog

How to Set Up and Use YUM Repositories on a CentOS VPS (DNF Guide)

Learn how CentOS Stream uses DNF for YUM repositories: configure upstream sources, build a private repository, generate repodata, verify GPG signatures, and troubleshoot missing packages or stale metadata.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On a current CentOS Stream VPS, “YUM repository” configuration is handled by dnf. To add a repository, create a uniquely named stanza in a separate .repo file under /etc/yum.repos.d/, point baseurl at a reachable directory containing repodata/, and enable GPG verification. For a repository you control, generate that metadata with createrepo_c (or createrepo), publish the directory over HTTPS, and refresh the client cache after every content change.

The procedure below covers upstream and vendor repositories, a private RPM repository, package and metadata signing, repository inspection, controlled enablement, and the failure modes that most often make DNF report that a repository or package does not exist.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What a YUM repository is on a CentOS VPS

A repository is a published collection of RPM packages plus metadata describing those packages, their checksums, dependencies, architectures, and versions. The client reads that metadata before it chooses packages for an install or update. A directory containing RPM files but no current repodata/ directory is not a usable DNF repository.

CentOS Stream systems normally use dnf, although administrators still commonly say “YUM repository.” The repository format and the familiar configuration concepts remain the same. Each repository is identified by the value inside square brackets in its configuration stanza, and that ID must be unique across the client’s enabled configuration.

Keep the client and publishing roles separate

Your VPS is the client when it consumes packages. A different server, build host, or staging directory is the repository host when it stores RPMs and publishes metadata. An upstream project or vendor can provide the repository host for you; a private repository requires you to perform both the publishing and client-configuration work.

Decide what kind of repository you need

  • Public upstream repository: maintained by the operating-system project or another established open-source project.
  • Vendor repository: maintained by a software publisher and usually distributed as a release RPM that installs a repository file and signing key.
  • Private repository: a directory of RPMs that your team builds or approves, with metadata generated and published by your infrastructure.

Before adding anything, check that the source supports the CentOS release running on the VPS and its CPU architecture. Also check the project’s current status and package freshness. A repository can still be reachable while carrying obsolete packages or instructions for a retired project.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prerequisites and safe defaults

  • Root or sudo access on the VPS.
  • A CentOS release and architecture that match the repository path and RPMs.
  • Outbound network access from the VPS to the repository’s host and port.
  • A repository URL that serves metadata, not merely an individual RPM file.
  • A trusted public GPG key for the publisher before strict signature checking is enabled.
  • Separate configuration files for custom repositories, rather than adding custom stanzas to /etc/dnf/dnf.conf.

Use a descriptive filename such as /etc/yum.repos.d/example.repo. Keeping one custom repository per file makes it easier to inspect, disable, replace, or remove a source without changing unrelated configuration.

Add an upstream or vendor repository

Preferred method: a maintained release package

When a project supplies a current release RPM, it is usually the least error-prone way to install its repository definition. CentOS documentation describes the pattern: import the project’s public RPM GPG key, then install the release RPM. The release package supplies a repository file and can also carry key or configuration updates.

Do not install a release package solely because an old tutorial mentions it. Verify that the project still supports your CentOS Stream release, that the package is current, and that its repository path and signing key are still maintained. CentOS documentation explicitly marks some SIG instructions as archived and warns that their shipped versions are outdated; archived instructions should not be treated as a current installation guide.

Manual repository definition

Create a file below /etc/yum.repos.d/. This example shows the minimum settings normally needed for an HTTPS RPM repository:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
[example]
name=Example RPM repository
baseurl=https://repo.example.invalid/centos/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.example.invalid/RPM-GPG-KEY-example

Replace the example host with the real repository supplied by the publisher. The URL must resolve to a directory whose contents include repodata/. The $releasever and $basearch variables are substituted by DNF; the resulting path must actually exist for the VPS. If a publisher provides a mirrorlist or metalink instead of a fixed path, use the publisher’s supplied setting rather than guessing a URL.

  • [example] is the repository ID. It must be unique.
  • name is the human-readable label shown by repository-listing commands.
  • baseurl identifies the repository directory, not one package.
  • enabled=1 makes the repository available to normal transactions. Use enabled=0 for a source that should be activated only for a deliberate test or install.
  • gpgcheck=1 requires RPM signature verification.
  • gpgkey identifies the publisher’s public key. Treat a key as trusted only after confirming its provenance.

Save the file, then inspect what DNF sees:

sudo dnf repolist

The new ID should appear with an enabled status. If it does not, check the filename, stanza syntax, duplicate IDs, and whether the file is readable by root.

Add a URL with dnf config-manager

DNF can create a repository file from a repository URL:

sudo dnf config-manager --add-repo <repository_URL>

Repositories added this way are enabled by default. Inspect the generated file under /etc/yum.repos.d/ rather than assuming every generated value is appropriate for your release and architecture. If you need to stop using it, disable the repository by ID:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo dnf config-manager --disable example

Use the exact ID shown by dnf repolist; the ID is not necessarily the same as the filename.

Create a private RPM repository

A private repository is simply a directory of compatible RPMs accompanied by generated metadata and a transport that the VPS can reach. The following workflow can run on a repository host or in a staging directory before publication.

1. Install the metadata generator

sudo dnf install -y createrepo_c

Some CentOS environments provide the package under the older createrepo name. Use whichever package is available on the repository host. The current Red Hat workflow uses createrepo_c.

2. Create a repository directory and copy packages

sudo mkdir -p /srv/repos/example
sudo cp /path/to/packages/*.rpm /srv/repos/example/

Only copy RPMs intended for the target CentOS release and architecture, unless you deliberately maintain separate compatible content in the same repository. Metadata cannot make an incompatible binary safe to install, and mixing unrelated architectures creates confusing dependency and installation failures.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Generate metadata

sudo createrepo_c /srv/repos/example/

The command creates the repodata/ directory. CentOS documentation demonstrates the same process with createrepo; both tools produce the repository metadata DNF consumes.

4. Publish the directory

Expose /srv/repos/example/ through an HTTPS web server or another transport supported by your environment. The client’s baseurl must point at the directory containing repodata/. Pointing at a parent directory with no metadata, or directly at one RPM, will not create a functioning repository.

5. Configure the VPS client

sudo tee /etc/yum.repos.d/example.repo >/dev/null <<'EOF'
[example]
name=Example private repository
baseurl=https://repo.example.invalid/centos/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.example.invalid/RPM-GPG-KEY-example
EOF

Use your real publication URL and key location in place of the example values. Then confirm reachability and visibility:

sudo dnf repolist
sudo dnf --disablerepo='*' --enablerepo=example list available

Update metadata when packages change

Adding or replacing an RPM does not automatically update the repository’s metadata. Regenerate it after package changes, then clear stale client data and rebuild the cache:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo createrepo_c --update /srv/repos/example/
sudo dnf clean all
sudo dnf makecache

The --update form refreshes an existing repository. On the VPS, dnf clean all removes cached repository data and dnf makecache downloads fresh metadata. If a new package is missing from search results, perform these steps before changing repository settings.

Verify packages and repository metadata with GPG

Package signatures

Keep the private signing key off the VPS whenever possible. Sign RPMs on a controlled build or release host, publish the corresponding public key, and configure the client with gpgcheck=1. You can import the public key on the client before enabling strict verification, or let the repository’s gpgkey= URL identify the key during the transaction. Confirm that the key belongs to the expected publisher; a reachable key is not automatically a trustworthy key.

When DNF reports a signature failure, do not permanently set gpgcheck=0 to bypass it. A failed check can indicate a wrong key, an unreachable key URL, a package signed by a different release key, or tampered content.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Metadata signatures

Package checks protect individual RPMs. For stronger repository integrity, sign repomd.xml after generating metadata and publish the detached signature with the repository. Red Hat documentation describes enabling repository metadata checking with check_repogpg = true; CentOS’s delivery process likewise describes signing both packages and repomd.xml before publication. Use the exact metadata-checking setting supported by the CentOS and DNF versions on your client, and verify that the signature is produced after the final metadata update.

Install and update from a repository deliberately

Once the repository is visible and trusted, normal package operations are straightforward:

sudo dnf install package-name
sudo dnf update

For an experimental source, keep it disabled by default and enable it for one transaction. CentOS project documentation uses the following pattern:

sudo dnf --disablerepo='*' --enablerepo=example list available

You can use the same repository-selection approach with an install command when you want DNF to consider only that source. This reduces accidental upgrades from a testing repository and makes the transaction’s provenance easier to audit.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Inspect repository state and configuration

List enabled repositories

sudo dnf repolist

This is the first check when a repository appears to be missing. It shows the IDs DNF currently recognizes as enabled.

List packages from one source

sudo dnf --disablerepo='*' --enablerepo=example list available

If this returns packages, the repository is readable and its metadata is being consumed even if another command’s broader package query is affected by filters or other enabled sources.

Inspect the actual stanza

sudo grep -R -n -E '^[|^(name|baseurl|mirrorlist|metalink|enabled|gpgcheck|gpgkey)=' /etc/yum.repos.d/

Look for duplicate IDs, an incorrect release variable, disabled status, a mistyped key URL, or a base URL that ends above the directory containing repodata/.

Choose between repository sources

There is no universally best source. Evaluate each candidate against the same operational criteria:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Criterion What to verify Why it matters
Release and architecture compatibility The repository path and RPMs match the VPS’s CentOS release and $basearch. Prevents unresolved dependencies and incompatible binaries.
Provenance and signatures The publisher provides a verifiable GPG key and signed RPMs; metadata-signing support is a further benefit. Lets DNF detect altered or incorrectly sourced packages.
Update cadence Packages and repository instructions are maintained rather than archived. Reduces exposure to stale fixes and broken release paths.
Transport and availability HTTPS, or a maintained mirrorlist/metalink, is reachable from the VPS. Determines whether clients can consistently download metadata and RPMs.
Default enablement Whether the source is enabled automatically or intended for explicit, per-transaction use. Controls the risk of unexpected package selection or upgrades.
Release-package support The project supplies a maintained package that installs its .repo file and key. Can simplify updates to repository configuration, provided the package remains current.

Troubleshoot the common failures

DNF says no packages are available

  1. Run sudo dnf repolist and confirm the repository ID is enabled.
  2. Check that the configured URL resolves to a directory containing repodata/, not just RPM files.
  3. Evaluate $releasever and $basearch on this VPS and confirm that the resulting directories exist on the server.
  4. Use sudo dnf --disablerepo='*' --enablerepo=example list available to isolate the source from every other repository.

GPG verification fails

  • Confirm that the public key belongs to the repository publisher.
  • Check that the gpgkey URL is reachable from the VPS and that the key has not been replaced unexpectedly.
  • Verify that the RPM was signed with the key configured for this repository.
  • For metadata verification, check that the published repomd.xml signature corresponds to the latest generated metadata.
  • Do not resolve the error by leaving gpgcheck=0 enabled.

A newly copied RPM does not appear

Regenerate metadata with createrepo_c --update, run sudo dnf clean all on the client, and rebuild the cache with sudo dnf makecache. Until those steps occur, DNF may continue using metadata that predates the package.

Dependency or architecture errors occur

Check every RPM’s target release and architecture, and verify that required dependencies are available from compatible enabled repositories. Metadata only describes what is present; it cannot convert an RPM built for a different platform into a compatible package.

The repository contains unexpected or obsolete packages

Stop and inspect the project’s current documentation and status before installing anything. In particular, do not follow CentOS SIG pages explicitly labeled archived or obsolete. Replace stale release packages and repository files with a maintained source rather than layering new settings on top of an outdated one.

Operational checklist

  • Give every repository a unique ID in its own file under /etc/yum.repos.d/.
  • Point baseurl, mirrorlist, or metalink to a location that actually contains repodata/.
  • Match the repository to the VPS release and architecture.
  • Keep gpgcheck=1 and use a verified publisher key.
  • Sign repomd.xml as well as RPMs when your repository workflow supports metadata verification.
  • Keep experimental sources disabled and enable them only for a deliberate transaction.
  • After changing private-repository content, regenerate metadata, clean client caches, and run dnf makecache.
  • Review project status and package freshness before installing a release RPM or following repository instructions.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.