Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Note: This is my first question on the stack exchange network so please give mercy and provide guidance where needed.

I have installed a CentOS 6.2 KVM guest and I am having problem getting yum to work. This is my first time working with CentOS so I feel that it's a setting somewhere that I am missing but cannot find using google.

Here are my steps;

  • Downloaded CentOS-6.2-x86_64-minimal.iso, booted, and went through default steps (only questions asked where keyboard, timezone, root password and use entire hdd)
  • Restarted, logged in, pinged google.com to no avail
  • Set the following settings;

vi /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
HWADDR="52:54:00:42:1B:4A"
#NM_CONTROLLED="yes"
BOOTPROTO=none
ONBOOT="yes"
NETMASK=255.255.255.0
IPADDR=192.168.122.151
TYPE=Ethernet

vi /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=server3.example.com
GATEWAY=192.168.122.1
  • I can now ping google.com

ping google.com

PING google.com (173.194.70.139) 56(84) bytes of data.
64 bytes from fa-in-f139.1e100.net (173.194.70.139): icmp_seq=1 ttl=50 time=5.88 ms
64 bytes from fa-in-f139.1e100.net (173.194.70.139): icmp_seq=2 ttl=50 time=5.77 ms
  • But I cannot 'yum update'

yum update

Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 7 - "Failed to connect to 2a01:c0:2:4:216:3eff:fe0d:266d: Network is unreachable"
Error: Cannot find a valid baseurl for repo: base

My KVM guest is also NAT'd incase it's of concern.

share|improve this question
    
Check the proxy configuration in /etc/yum.conf. That did the trick for me. Got to add : proxy=blah:port –  user125073 Jun 18 '12 at 14:16
    
What is the output of ip addr? –  Michael Hampton Oct 26 '12 at 6:22

7 Answers 7

Your system is finding an IPv6 address for mirrorlist.centos.org in DNS and then failing to connect to it. Unless you actually have IPv6 connectivity, you should disable IPv6.

share|improve this answer
3  
Thanks for the reply. I have done this, but the same error. I started from scratch (reinstalled OS) in case it was the "loading mirror speed from cached hostfile" but it's the same error. If I ping "mirrorlist.centos.org" I get a valid IPV4 address (69.30.193.218). –  Owen Jun 18 '12 at 8:45

I have the same problem when I try install a VM with CentOS 6.3 using minimal install. I take some time to figure out that I was behind another CentOS as a firewall with proxy enable. All I have to do was apply some rules at the firewall to set this VM with free access to HTTP port.

share|improve this answer

It is about python urlgrabber. You can add mirrorlist.centos.org IPv4 IP addresses to /etc/hosts file. Then it will connect to mirrorlist.centos.org thru IPv4.

share|improve this answer

You should check your CentOS-Base.repo and other .repo mirrorlist/baseurl parameter. Is seems you have ftp:// or https:// protocol addresses instant of http://

[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/

While I have the same KVM server/guest configuration and there was some problem with my iptables config, I've changed some /etc/yum.repos.d baseurls addresses to the ftp:// a week ago, now I've checked it out and turn it back to the original state and everything is fine.

share|improve this answer

Try this:

export http_proxy=http://username:password@proxyServerIP:proxyServerPort/

It will create an environment variable for http_proxy.

I have successfully done this with yum update

share|improve this answer
    
This presumes they're behind a proxy. There's no indication of that in the question... –  voretaq7 Nov 28 '12 at 19:21

If you are behind a proxy and probably have IPv6 tunnel the solution given by Charles above must solve your problem

export http_proxy=http://username:password@proxyServerIP:proxyServerPort/
share|improve this answer

Since your network checks out OK, it is more likely that you have a system-wide proxy setting in your environment. I have run into this before, and failing to check this obvious possibility wasted my time ..

check for the presence of http_proxy variable in your environment with:

env | grep -i proxy

If found, 'unset http_proxy' should remove proxy setting for the current shell. ..

To remove the setting for future shells, look for where it has been set:

  • In RHEL based systems, it is common to set these in /etc/profile.d/proxy.sh ..

It is a real shame that yum update does not output any status message that clearly shows it's using a proxy for http connections .. in the intial phase where mirrorlists are downloaded (it does show it later on after downloading the packages) ..

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.