Centos:无法检索镜像列表

时间:2014-07-21 09:21:22

标签: apache centos yum

我无法使用yum命令安装任何服务。 当我尝试通过键入

来安装httpd时
[root@kstest /]# yum install httpd
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
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras error was
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates error was
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
 * base: centos.aol.in
 * extras: centos-hn.viettelidc.com.vn
 * updates: centos.aol.in
http://centos.aol.in/6.5/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://centos.aol.in/6.5/os/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
Trying other mirror.

之后,当我尝试使用yum命令时,它说

Existing lock /var/run/yum.pid: another copy is running as pid 2063.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  22 M RSS (219 MB VSZ)
    Started: Mon Jul 21 05:09:53 2014 - 01:09 ago
    State  : Traced/Stopped, pid: 2063

解锁我输入的

ps aux | grep yum
kill -9 <pid number>

当我尝试通过键入

来更新yum时
yum update -y

我收到以下

[root@kstest etc]# yum update -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.in
 * extras: centos-hn.viettelidc.com.vn
 * updates: centos.aol.in
http://centos.aol.in/6.5/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://centos.aol.in/6.5/os/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
Trying other mirror.

如何解决此问题? 我该如何安装httpd?

我的yum.repos.d文件存在于etc /中为空。我的yum.conf文件是

[main]
proxy=http://proxy.com:8000
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

我添加了它的代理。以前不存在。

3 个答案:

答案 0 :(得分:0)

自6.4以来我一直有同样的问题,我仍然感到震惊,因为没有一个容易找到的解决方案。快速的解决方法是注释掉所有的mirrorlist行并取消注释所有baseurl行,但根据一些论坛中的某些人说这不是一件好事。

答案 1 :(得分:0)

可以通过修复网络设置来解决此问题。 IPv6镜像不适用于所有设置。我使用Ansible做的是禁用IPv6并使用Google的公共解析器。该剧本假设SELinux已被禁用。

---
- hosts: all
  user: vagrant
  sudo: True
  tasks:


  - name: "disable ipv6"
    shell: echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6

  - name: "disable ipv6"
    shell: echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6

  - name: "restart network"
    service: name=network state=restarted

  - name: "add public resolver"
    lineinfile: dest=/etc/resolv.conf regexp='^nameserver' 
              line='nameserver 8.8.8.8' state=present

  - name: "clean yum"
    shell: yum clean all

  - name: "warmup Yum"
    shell: yum search libselinux-python

  - name: "use Yum"
    yum: name={{ item }} state=installed
    with_items: 
      - libselinux-python

  - name: "Enable SELinux"
    selinux: policy=targeted state=permissive

答案 2 :(得分:0)

如果您在 /etc/yum.conf 中定义代理服务器,则所有用户在使用yum时都会使用这些详细信息连接到代理服务器。要使所有yum操作都能使用代理服务器,请在/etc/yum.conf中指定代理服务器详细信息。

在/etc/yum.conf中添加如下所示的条目,以使yum能够使用代理(此处为代理服务器:abc.mydomain.com,连接到端口8080)

代理= http://abc.mydomain.com:8080