Sunday, December 20, 2009

How to disable yum faster mirror plugin (CentOS/Fedora Core)

Symptoms:

Faster-mirror plugin for YUM does not choose the "faster" mirrors, which are within my country.

For example, YUM faster-mirror chooses a mirror in Australia, instead of Singapore.

[root@vmxdb02 ~]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.aarnet.edu.au
* updates: mirror.optus.net
* addons: mirror.aarnet.edu.au
* extras: mirror.primusdatacentre.com.au
primary.sqlite.bz2 | 1.3 MB 01:28

Current download cancelled, interrupt (ctrl-c) again within two seconds to exit.

primary.sqlite.bz2 | 0 B 00:00


Solutions:

Step 1, disable fast-mirror plugin, by editing file "/etc/yum/pluginconf.d/fastestmirror.conf", change "enabled=1" to "enabled=0"

[main]
enabled=0
verbose=0
socket_timeout=3
hostfilepath=/var/cache/yum/timedhosts.txt
maxhostfileage=10
maxthreads=15
#exclude=.gov, facebook


Step 2, get URLs for list of mirrors near you. This URL is for CentOS: http://www.centos.org/modules/tinycontent/index.php?id=32


Step 3, Comments these mirrorlist URLs, and use the baseurl (multiple baseurls can be put together to enable failover.) Including "failovermethod=priority" line as well.

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
failovermethod=priority
baseurl=http://mirror.averse.net/centos/$releasever/os/$basearch/
http://mirror.nus.edu.sg/centos//$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
failovermethod=priority
baseurl=http://mirror.averse.net/centos/$releasever/updates/$basearch/
http://mirror.nus.edu.sg/centos//$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

1 comment: