Yum 更新在 CentOS 6.2 最小安装上不起作用

Yum 更新在 CentOS 6.2 最小安装上不起作用

注意:这是我在 Stack Exchange 网络上提出的第一个问题,因此请给予宽容并在需要时提供指导。

我安装了 CentOS 6.2 KVM 客户机,但在使用 yum 时遇到了问题。这是我第一次使用 CentOS,所以我觉得我遗漏了某个设置,但无法使用 Google 找到。

这是我的步骤;

  • 下载了 CentOS-6.2-x86_64-minimal.iso,启动并执行默认步骤(仅询问键盘、时区、root 密码和使用整个硬盘的位置)
  • 重新启动、登录并 ping google.com,但无济于事
  • 设置以下设置;

修改 /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

六、/etc/sysconfig/网络

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=server3.example.com
GATEWAY=192.168.122.1
  • 我现在可以 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
  • 但我无法“yum update”

yum 更新

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

我的 KVM 客户机也经过了 NAT,以防万一。

答案1

您的系统在 DNS 中查找 IPv6 地址mirrorlist.centos.org,然后无法连接到该地址。除非您确实有 IPv6 连接,否则您应该禁用 IPv6

答案2

当我尝试使用最小安装安装带有 CentOS 6.3 的 VM 时,我遇到了同样的问题。我花了一些时间才弄清楚我位于另一个 CentOS 后面,因为防火墙启用了代理。我所要做的就是在防火墙上应用一些规则,以设置此 VM 可以自由访问 HTTP 端口。

答案3

这是关于 python urlgrabber 的。您可以将 mirrorlist.centos.org IPv4 IP 地址添加到 /etc/hosts 文件中。然后它将通过 IPv4 连接到 mirrorlist.centos.org。

答案4

尝试这个:

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

它将为 http_proxy 创建一个环境变量。

我已经成功完成了yum update

相关内容