Linux

Where Does DNF Keep Config and Cache?

DNF reads repos from /etc/yum.repos.d with behavior in /etc/dnf/dnf.conf, caching metadata under /var/cache/dnf.

Last updated

DNF splits settings across two config spots and one cache. Repository entries live as .repo files in /etc/yum.repos.d, kept under the old yum name for compatibility. Global behavior such as parallel downloads and keepcache sits in /etc/dnf/dnf.conf.

Downloaded metadata and packages accumulate in /var/cache/dnf. That folder grows quietly on systems that update daily. Clean it with dnf clean all when disk space tightens; repos re download on the next run.

Where DNF stores this, by platform

Linux
/etc/yum.repos.d

One .repo file per repository with baseurl and gpgkey. Global knobs live in /etc/dnf/dnf.conf beside it. Disable repos by file rather than deleting.

Linux
/var/cache/dnf

Metadata and package cache per repo. Safe to clear with dnf clean all. Rebuilds automatically on the next install or upgrade.

Frequently asked questions

Where do I add a third party DNF repo?

Drop its .repo file into /etc/yum.repos.d or install its release RPM. Import the GPG key it names before first use. Enable it per command with dnf with repo flags.

Why is /var/cache/dnf so large?

Every enabled repo caches metadata and recently fetched packages there. Set keepcache off in dnf.conf to retain metadata only. Run dnf clean all for immediate relief.

Notice an outdated path? Let us know.