I've noticed that YUM will seem to pick specific servers over and over when I perform yum update commands, but occasionally it'll switch and use alternative servers.

In poking around I noticed that it makes use of a plugin called yum-fastestmirror.

How does YUM and this plugin do this?



The plugin yum-fastestmirror is really simple in concept. It simply maintains a text file with times that YUM accumulates about each mirror and then when YUM is asked to download packages, it uses the server that's shown as the fastest for the duration of the download.

The times are stored in this location:

$ locate timedhosts.txt

If we inspect this file we'll come to find it's just hostnames with times next to each. Here we're sorting it from fastest to slowest:

$ sort -k2,2 /var/cache/yum/x86_64/7/timedhosts.txt
mirror.atlanticmetro.net 0.00165295600891
mirror.cc.columbia.edu 0.00172901153564
ewr.edge.kernel.org 0.00207901000977
mirror.es.its.nyu.edu 0.00217700004578
mirror.siena.edu 0.00543117523193
mirror.pit.teraswitch.com 0.0140120983124
mirrors.rit.edu 0.0208911895752
mirror.clarkson.edu 0.0243170261383
mirror.linux.duke.edu 0.0244128704071
mirror.mia11.us.leaseweb.net 0.0328259468079
mirror.hackingand.coffee 0.0435431003571
ftp.ussg.iu.edu 0.0479228496552
mirror.genesishosting.com 0.0481269359589
repo1.ash.innoscale.net 0.050274848938
mirror.den1.denvercolo.net 0.0838551521301
mirror.keystealth.org 0.134334802628
centos.mirror.ndchost.com 0.140916824341

Now when we inquire about a specific package's location if we were to download it using repoquery:

$ $ repoquery --location java-1.8.0-openjdk


The yum-fastestmirror plugin also has its own config file:

$ more /etc/yum/pluginconf.d/fastestmirror.conf
always_print_best_host = true
#  Relative paths are relative to the cachedir (and so works for users as well
# as root).
#exclude=.gov, facebook

Through this file we can instruct the plugin to whitelist & blacklist specific mirrors that have either presented us with issues in the past or we've deemed unacceptable for whatever reasons.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.