6

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.

Owen
  • 61
  • 1
  • 1
  • 3

7 Answers7

6

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.

mgorven
  • 30,615
  • 7
  • 79
  • 122
  • 4
    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 08:45
  • I still got the same error after disabling IPv6. I discovered that my default gateway was missing. I added it using `route add default gw 192.168.1.254` and that fixed it – qbert220 May 25 '15 at 20:58
1

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.

0

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.

seaquest
  • 698
  • 2
  • 12
  • 25
0

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.

Daniel
  • 123
  • 1
  • 10
0

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

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109
Basu
  • 1
0

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

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) ..

Chux Uzoeto
  • 448
  • 4
  • 9