dnf-makecache(8)
Generate the DNF package manager cache from repository metadata.
Synopsis
dnf [OPTIONS] makecache [--refresh]Description
dnf makecache downloads and caches the metadata from all configured DNF repositories. This speeds up subsequent DNF operations by pre-populating the local cache instead of fetching metadata on each command.
By default, DNF automatically refreshes the cache when it expires (typically every 48 hours). This command is useful for manually refreshing the cache immediately, such as after adding new repositories or before running batch operations.
The --refresh flag forces a fresh download even if the cache is still considered valid.
Common options
| Flag | What it does |
|---|---|
--refresh | Force download of fresh metadata even if cache is still valid |
-y, --assumeyes | Assume yes to all prompts; useful in scripts |
-v, --verbose | Increase verbosity to show detailed cache download progress |
--enablerepo=REPO | Enable a specific repository for cache generation |
--disablerepo=REPO | Disable a specific repository when generating cache |
--releasever=VERSION | Set the release version for repository variable substitution |
Examples
Build the DNF cache from configured repositories; runs silently if cache is fresh
sudo dnf makecacheForce a fresh download of all repository metadata, updating the cache immediately
sudo dnf makecache --refreshRefresh the cache with verbose output showing download progress for each repository
sudo dnf makecache --refresh -vGenerate cache including only the fedora-updates repository
sudo dnf makecache --enablerepo=fedora-updatesSilently refresh cache and pipe output to check for any errors
sudo dnf makecache -y 2>&1 | grep -i errorRefresh the cache and immediately check for available package updates
dnf makecache --refresh && dnf upgrade