Centos – Yum update error: Could not retrieve mirrorlist

centosterminalyum

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:

nameserver 130.102.115.238
nameserver 130.102.128.53
nameserver 130.102.2.53

I tried adding nameserver 8.8.8.8. It didn't work.

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

[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/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#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/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

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.

Best Answer

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.

Related Question