9

Is it possible to specify a mirror for YUM to target when doing updates? I've noticed on my CentOS 6.2 servers that it takes up to a minute for YUM to respond from a given command. I did some Googling and found that YUM reads from a timedhosts.txt file, so I viewed the contents and it was pretty nasty. There were 49 lines, 32 of which had a value of 99999999999, which I assume to be a timeout.

There has to be a way for me to specify a mirror I know would be lightning fast (being from SoCal I would like to use http://mirrors.usc.edu/.

1

2 Answers 2

11

There is nothing stopping you from disabling the default repos and adding an entry that points to the specific server you want to use. For example:

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.usc.edu/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1

[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.usc.edu/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
1
  • 7
    which file is this? yum.repos.d ?
    – user157735
    Feb 21, 2019 at 10:00
4

Do you have the fastest-mirror plugin installed? centos wiki You could edit the base link, in /etc/yum.repos.d/CentOS-Base.repo, to reflect the repo you would like. I am not sure this is best though.similiar to how this was done with the local repo

1
  • 1
    Nice. Looks like I'm not the only one. Came across the following when I googled for 'centos yum disable cache hostfile': dbaglobe.com/2009/12/… Gonna try it, if it works I'll accept. Mar 1, 2012 at 2:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .