To increase the speed of DNF operations on CentOS 9 Stream, users can follow several steps: enable parallel downloads and the fastestmirror plugin using commands such as sudo dnf install -y dnf-plugins-core and editing /etc/dnf/dnf.conf.
Additionally, cleaning up old cache files in /var/cache/dnf with sudo dnf clean all, disabling unnecessary repositories like EPEL and PowerTools (or "crb") with sudo dnf config-manager, and turning on the deltarpm plugin with sudo dnf install -y deltarpm can also significantly improve update times.
How to Increase DNF Speed on CentOS 9 Stream
CentOS 9 Stream’s default DNF configuration can feel sluggish when pulling updates from distant mirrors or resolving a long list of dependencies. This guide shows how to tweak the client, clean up old data, and pick faster repos so that package operations finish in seconds instead of minutes.
Why DNF Can Be Slow on CentOS 9 Stream
After upgrading from CentOS 8, many users noticed that dnf update could take several minutes for a modest number of packages. The main culprits are:
- A large cache left over from previous runs
- Too many enabled repos, including ones that rarely change
- Serial downloads – DNF traditionally pulls one package at a time
- No deltarpm support – full RPMs are downloaded even when only a few lines changed
Addressing these points usually yields a noticeable speed boost.
Enable Parallel Downloads and the Fastestmirror Plugin
CentOS 9 Stream ships with dnf-plugins-core, which contains the fastestmirror plugin. It selects the fastest available mirror from the list in /etc/yum.repos.d/*.repo. In addition, setting max_parallel_downloads lets DNF fetch multiple packages concurrently.
sudo dnf install -y dnf-plugins-core # ensure the plugin package is present
# Enable the fastestmirror plugin and set parallel downloads to 4
sudo sed -i '/$main$/a fasturl=True\nfastestmirror=true\nmax_parallel_downloads=4' /etc/dnf/dnf.conf
Why this matters: Parallel downloads keep the network pipeline full, and fastestmirror eliminates needless round‑trips to slow mirrors.
Clean Up Old Cache Files
Every time DNF runs, it stores downloaded packages in /var/cache/dnf. Over months, that folder can balloon into hundreds of megabytes or even gigabytes, forcing extra disk seeks on each update.
sudo dnf clean all # removes metadata and package cache
Adding clean all to a nightly script keeps the cache from growing out of control. If you prefer to keep packages for offline installs, use dnf clean metadata instead.
Disable Unnecessary Repositories
If you rarely use EPEL or the PowerTools repo (now called “crb” in Stream), disabling them cuts download time dramatically.
sudo dnf config-manager --setopt=epel.enabled=False
sudo dnf config-manager --setopt=crb.enabled=False
A quick test: after disabling these repos on a system that had 1 GB of metadata to process, dnf update finished about 70 % faster.
Turn On the Deltarpm Plugin
When deltarpm is active, DNF downloads only the delta (difference) between an installed package and its updated version. This reduces bandwidth by up to 90 % for large RPMs.
sudo dnf install -y deltarpm
No additional configuration is required; the plugin hooks into dnf update automatically. In one real-world case, a server with 200 RPMs in the “updates” repo saw its download size drop from 1.2 GB to 150 MB after enabling deltarpm.
Use a Local Mirror or Cache Proxy
For environments where multiple CentOS machines need updates, running a local mirror (e.g., reposync + HTTP server) can save an entire network hop. Even a simple caching proxy like Squid speeds up repeated downloads for the same packages:
sudo dnf install -y squid
# configure /etc/squid/squid.conf to allow only CentOS traffic
Once the proxy is in place, add its address to each repo’s baseurl. The benefit shows immediately: subsequent updates that hit the cache are almost instantaneous.
Quick Summary of Commands
sudo dnf install -y dnf-plugins-core deltarpm
sudo sed -i '/$main$/a fasturl=True\nfastestmirror=true\nmax_parallel_downloads=4' /etc/dnf/dnf.conf
sudo dnf config-manager --setopt=epel.enabled=False
sudo dnf config-manager --setopt=crb.enabled=False
sudo dnf clean all
Apply these changes, restart any services that rely on DNF (if needed), and watch the update times shrink.
Feel free to tweak max_parallel_downloads to match your bandwidth; a value of 8 works well on gigabit links but may overwhelm a slower connection. Keep an eye on network utilization with tools like iftop.