CentOS Yum: Disable A Specific Mirror
Installing a bunch of packages on a CentOS server today I ran into an issue where the CentOS Base mirror I was using was incredibly slow. First I checked to make sure that the yum-fastestmirror plugin was installed which it was. Next I attempted to clear the fastest mirror plugin cache by running “yum clean plugins” but I ended up with the same exact CentOS Base mirror yet again. Follow the directions below to disable a specific mirror from yum.
Exclude Or Disable A Specific Mirror From Yum:
This can be accomplished by disabling the mirror in the yum-fastestmirror configuration file which is called fastestmirror.conf and located in the /etc/yum/pluginconf.d directory. The default configuration is listed below.
Default fastestmirror.conf Configuration File:
[main] enabled=1 verbose=0 socket_timeout=3 hostfilepath=/var/cache/yum/timedhosts.txt maxhostfileage=10 maxthreads=15 #exclude=.gov, facebook
In my case I needed to exclude mirrors.bluehost.com mirror because of incredibly slow speeds so your updated fastestmirror.conf file would look similar to the below.
fastestmirror.conf Configuration File With Disabled Mirror:
[main] enabled=1 verbose=0 socket_timeout=3 hostfilepath=/var/cache/yum/timedhosts.txt maxhostfileage=10 maxthreads=15 #exclude=.gov, facebook exclude = mirrors.bluehost.com
After adding the exclude line at the end of the fastestmirror.conf configuration file my package download speed issues were resolved. The changes will start working immediately after making the change.