Yum update error: Could not retrieve mirrorlist

  • I'm trying to do yum update. This is the error I'm getting.

    sudo yum update
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
    12: Timeout on http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os: (28,'connect() timed out!')
    Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

    I did wget http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os. It never goes through. So I know I've to change this somehow. Can anyone tell suggest me how to fix this. I found many posts related to this problem over here; but couldn't find a proper solution for this.

    My /etc/resolve.conf is:


    I tried adding nameserver It didn't work.

    My /etc/yum.repos.d/Centos-Base.repo is:

    name=CentOS-$releasever - Base
    #released updates
    name=CentOS-$releasever - Updates
    #additional packages that may be useful
    name=CentOS-$releasever - Extras
    #additional packages that extend functionality of existing packages
    name=CentOS-$releasever - Plus
    #contrib - packages by Centos Users
    name=CentOS-$releasever - Contrib

    I tried commenting the mirrorlists and uncommenting the baseurls. Didn't work. I really need some help with this. Stuck on this for sometime now.

    PS I am trying to set a Hadoop node using Cloudera. That's when I encountered this problem. So I tried doing a yum update individually to figure out what's wrong.

    did you try to access the url by browser? are you behind a proxy? what happen when you nslookup the urls?

    Yes i am behind a proxy. In order to get my firefox running through this remote server I have to export http_proxy. I did nslookup, it says server can't find it.

    Do you have the proxy information configured in yum.conf?

  • John

    John Correct answer

    7 years ago

    It looks like you don't have the proxy information configured in your repo file. According to http://www.centos.org/docs/5/html/yum/sn-yum-proxy-server.html, you have to specify your proxy, proxy_username, and proxy_password in yum.conf. This doc is for CentOS 5, but it should hold for CentOS 6 as well.

    As you suggested I edited my yum.conf referring the link. I used export http_proxy. But now I get CRITICAL:yum.cli:Config Error: Parsing file failed: File contains parsing erro: file:///etc/yum.conf [line 15]: export http_proxy I dont want to include my credentials in the file. SO I have set up proxy through the command line before editing this. What am I doing wrong?

    Awesome. As a temporary fix I included my credentials in yum.conf and it worked. Still I would love to know how to make it secure. Now any user will be able to use proxy server using my credentials.

    the link is broken. my yum.conf is in _/etc_, if anyone wonders

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM