How to Turbocharge DNF Download Speed on Rocky Linux 9
If your Rocky 9 updates feel like watching paint dry, you’re not alone.
This quick guide shows how to make the DNF download speed race ahead of your slow‑poke mirror list, DNS hiccups, and other hidden roadblocks.
Pick a Faster Mirror
The first thing that can kill your bandwidth is picking the wrong mirror.
I once helped a coworker stuck at 120 KB/s because their machine was hitting a Japanese server with no peering to my ISP. Switching to a nearby US mirror bumped things to over 2 MB/s.
1. Find a local mirror
Visit https://mirrors.rpmfusion.org or the official Rocky 9 mirror list and copy the URL of the closest one (look for “US” or your country code).
2. Tell DNF to use it
sudo tee /etc/dnf/dnf.conf.d/local-mirror.repo <<EOF [rocky-9-baseos] name=Rocky 9 BaseOS – Local Mirror baseurl=https://mirror.example.com/rockylinux/9/BaseOS/x86_64/os/ enabled=1 gpgcheck=0 [rocky-9-appstream] name=Rocky 9 AppStream – Local Mirror baseurl=https://mirror.example.com/rockylinux/9/AppStream/x86_64/os/ enabled=1 gpgcheck=0 EOF
Why this matters: By pointing DNF to a single, fast mirror you avoid the overhead of the default “mirrorlist” which pings dozens of servers before choosing one.
Enable the Fastest‑Mirror Plugin
DNF ships with an optional plugin that automatically picks the quickest server each time you update.
Even if you already set a local mirror, the plugin can still help for packages not on your chosen repo.
1. Install the helper
sudo dnf install -y dnf-plugins-core
2. Turn it on
sudo tee /etc/dnf/pluginconf.d/fastestmirror.conf <<EOF [main] enabled=1 fastestmirror_first=True EOF
3. Clear the cache to force a fresh check
sudo dnf clean all
4. Run your update again
sudo dnf upgrade
Why this matters: The plugin queries each mirror for its current download speed and selects the fastest, cutting down on unnecessary round‑trips.
Flush DNS and Disable IPv6 if Needed
Sometimes the bottleneck isn’t DNF at all—it’s your resolver or a misbehaving IPv6 route that forces traffic to take a detour.
1. Flush the local cache
sudo systemd-resolve --flush-caches
2. Temporarily disable IPv6 for testing
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
3. Run DNF again and see if the speed improves.
If you notice a jump, your router or ISP might be routing IPv6 traffic poorly. You can either keep it disabled in /etc/sysctl.d/99-disable-ipv6.conf or set up proper IPv6 routing.
Keep Your Cache Fresh
An old package cache forces DNF to download the same data again and again, wasting bandwidth.
sudo dnf clean packages sudo dnf makecache
Run this once a week (or after every major network change) to keep the local copy lean.
Test Your Speed
A quick sanity check with wget can confirm that your changes are paying off:
wget --output-document=/dev/null http://archive.ubuntu.com/ubuntu/dists/focal/main/binary-amd64/Packages.gz
If you see a throughput of several megabits per second, you’re good to go.
Give these tweaks a try next time your Rocky 9 update stalls. Once the mirrors are honest and DNF is pointed straight at them, you’ll notice the difference in seconds rather than minutes.