How to Increase DNF Speed on AlmaLinux 9
If you’re tired of waiting forever for a single package or kernel update, this guide will get your DNF downloads up and running fast enough that you’ll wonder why you ever used the default settings.
Step 1: Install the fastestmirror plugin
AlmaLinux ships with DNF 4, but it doesn’t enable the fastestmirror plugin by default.
sudo dnf install -y dnf-plugins-core
The plugin queries all available mirrors for each repo and picks the one with the best latency. Without it, you’re stuck downloading from whatever mirror the repo file points to—even if that mirror is a slow satellite.
Step 2: Point DNF at your fastest mirror list
Open /etc/dnf/dnf.conf in your favorite editor:
sudo nano /etc/dnf/dnf.conf
Add or edit these lines:
fastestmirror=True max_parallel_downloads=10 timeout=60
- fastestmirror=True tells DNF to choose the quickest server.
- max_parallel_downloads=10 lets DNF fetch up to ten packages at once; most systems handle that fine and it shrinks overall download time dramatically.
- timeout=60 raises the HTTP timeout so you’re not stuck on a single slow request.
If you’re behind a corporate proxy, add:
proxy=http://user:pass@proxy.example.com:3128
Step 3: Clean old metadata and cache
Stale metadata can make DNF think it needs to re‑download everything.
sudo dnf clean all
This forces a fresh pull of repo data, ensuring the fastestmirror plugin sees up‑to‑date mirror lists.
Step 4: Verify your mirror selection
Run a test install and watch the output:
sudo dnf -v install vim
You’ll see lines like:
Downloading Packages : 12% | 2.3 MB 1.2 MB/s | 00:01
If you notice “Downloading from repo https://mirror.example.com” and the URL is far away, your fastestmirror setting isn’t taking effect—double‑check the dnf.conf syntax.
Step 5: Disable IPv6 if it’s hurting you
Sometimes DNS resolution for IPv6 addresses hangs while IPv4 works fine. If you’ve noticed a pattern of slow downloads on networks that don’t support IPv6 well, add this to /etc/dnf/dnf.conf:
ipv6=disable
This forces DNF to use IPv4 only, cutting out the extra round‑trip.
Step 6: Keep your repos healthy
If a particular repo is consistently slow, consider pinning it to a known fast mirror. Edit the repo’s .repo file in /etc/yum.repos.d/ and replace mirrorlist= with a direct baseurl= pointing to your preferred server.
Real‑world tweak that saved me 2 × time
When I upgraded from AlmaLinux 8 to 9, the default mirror list was pointing at an African server. After enabling fastestmirror and bumping parallel downloads, my 10 GB upgrade finished in under seven minutes instead of the half‑hour I’d expected.
Final tip: Use dnf config-manager for quick switches
If you want to toggle settings without editing files manually:
sudo dnf config-manager --setopt=repo_gpgcheck=False
You can also enable or disable fastestmirror on a per‑repo basis with --save.
That’s it. Your DNF should now download and install packages in record time, leaving you more room to actually use the software instead of staring at a progress bar.