Centos:无法检索镜像列表

问题描述 投票:2回答:3

我无法使用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?

我在etc /中的yum.repos.d文件是空的。我的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

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

apache centos yum
3个回答
0
投票

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


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

0
投票

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

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

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

© www.soinside.com 2019 - 2024. All rights reserved.