How to disable the fastestmirror yum plugin in CentOS 7 Linux?
Disabling fastestmirror in CentOS/RHEL systems
The fastestmirror plugin automatically selects the fastest package mirror for your system. While useful, you might want to disable it if you’re experiencing slow mirror detection, prefer a specific mirror, or troubleshoot package manager issues.
The plugin is provided by yum-plugin-fastestmirror (on older EL7 systems) or as part of DNF’s core functionality (EL8+). Unlike older versions, modern systems don’t allow direct removal of this package due to dependency chains.
Check your system
First, identify what package manager your system uses:
cat /etc/os-release | grep VERSION_ID
- EL7/CentOS 7: Uses yum with plugin architecture
- EL8+/CentOS Stream 8+/Rocky/Alma: Uses DNF with modular plugin system
- Fedora 38+: Uses DNF5
Disabling on EL7 (yum)
The fastestmirror plugin reads configuration from /etc/yum/pluginconf.d/fastestmirror.conf. View the current settings:
cat /etc/yum/pluginconf.d/fastestmirror.conf
You’ll see output similar to:
[main]
enabled=1
verbose=0
always_print_best_host=true
socket_timeout=3
hostfilepath=timedhosts.txt
maxhostfileage=10
maxthreads=15
To disable the plugin, change enabled=1 to enabled=0:
sudo sed -i 's/^enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
Verify the change:
grep "^enabled" /etc/yum/pluginconf.d/fastestmirror.conf
Disabling on EL8+ (DNF)
Modern DNF versions handle mirror selection differently. If you want to disable fastest mirror detection, edit /etc/dnf/dnf.conf:
sudo vi /etc/dnf/dnf.conf
Add or modify:
fastestmirror=0
Alternatively, disable it temporarily for a single command:
sudo dnf --setopt=fastestmirror=0 update
Specifying a preferred mirror
If the issue is simply that fastestmirror picks a slow mirror, you can instead specify your preferred mirror directly. Edit your repo configuration:
sudo vi /etc/yum/repos.d/CentOS-Linux-BaseOS.repo
Replace the mirrorlist line with a direct baseurl:
# Comment out mirrorlist
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=baseos&infra=$infra
# Specify a direct mirror
baseurl=http://mirror.example.com/centos/$releasever/BaseOS/$basearch/os/
Use a geographically close or known-fast mirror from the CentOS mirror list.
Troubleshooting slow mirror detection
If fastestmirror itself is running slowly, check the age of the cached host file:
ls -la /var/cache/yum/timedhosts.txt
Remove stale cache to force re-detection:
sudo rm -f /var/cache/yum/timedhosts.txt
sudo yum clean all
For DNF:
sudo dnf clean all
sudo dnf makecache
Verify the plugin is disabled
Test that yum/dnf no longer uses mirror detection:
sudo yum check-update
or
sudo dnf check-update
You shouldn’t see messages about pinging or selecting mirrors. Run with verbose output to confirm:
sudo yum -v check-update 2>&1 | grep -i mirror
No output indicates the plugin is successfully disabled.