I run a centos7 in a virtual machine on my laptop. I was working abroad for a month, and yum figured that out and changed the repositories that it checks (I don't know how that happened! Maybe I upgraded yum and don't remember?). Now I'm back, but yum still wants to download things from the other side of the world. How do I change it back? Will it happen automatically after a few slow downloads or do I need to do so manually?


I've never used CentOS, but I've had a bit of a look around Google, and it seems to change enable/disable repositories, you should go to the /etc/yum.repos.d/ directory, open the .repo files associated with the country that Yum is trying to download from, and set enabled=0.

Presumably, you will also want to find the repository associated with the country that you're currently in and make sure it's set to enabled=1.

(Here's my source material: https://www.centos.org/docs/5/html/yum/sn-yum-maintenance.html)

As I said, I've never used CentOS or Yum, but are you sure it actually changed repositories? In my experience with other distributions, there's a mirror list that takes care of where (geographically) you're served from. For example, in Arch there's the /etc/pacman.d/mirrorlist, and you un-comment the mirror servers that you want to use. I would have guessed CentOS did something similar.

  • It definitely changed repos! yum prints which URLs it's using, the download times are quite a bit longer, and sometimes even times out. – pythonic metaphor Sep 8 '15 at 20:05
  • Well, if what I suggested in my answer doesn't work, let me know and I'll do some more digging (although there's only so much I can do without actually setting CentOS up myself). – realityChemist Sep 8 '15 at 20:08
  • In my install, I don't see any .repo directories in /etc/yum.repos.d/. However, from your link, I did start looking around in /var/cache/yum and saw that it had some bad cached timings for repos. I remove those files and when I ran yum again, it said it was 'Determining fastest mirrors', but then all the mirrors it determined were still on the other side of the world. Somehow it seems to have limited itself to testing hosts there. – pythonic metaphor Sep 8 '15 at 20:16
  • Interesting... What version of CentOS are you using, and what is your computer's architecture? If you know that, you can go to mirrorlist.centos.org/… (replace the environment variables as appropriate) and look at the public mirrorlist there. That might give some clues as to what's going on. There may be a way to grab a specific mirror from the list, but I'd have to think on it for a while. – realityChemist Sep 8 '15 at 20:44
  • It's centos7 running in a x86_64 virtual machine. I can see that mirror list, but it's interesting that even after deleting mirrorlist.txt from all the cache subdirectories and timedhosts.txt, it is still picking up hosts there. – pythonic metaphor Sep 8 '15 at 20:59

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.