首页 文章

YumRepo错误:所有镜像URL都不使用ftp,http [s]或文件

提问于
浏览
14

我在 Windows 8.1 主机笔记本电脑上使用 VMWare Workstation 9 设置了 centOS 6.5 server . 当尝试使用 yum 来安装软件包时,我收到以下错误:

[root@localhost ~]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. </html>/
removing mirrorlist with no valid mirrors: /var/cache/yum/i386/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

VM可以在其他机器上工作( Windows 7 桌面和 Windows 8.1 笔记本电脑),而不是我需要它的工作 . 我可以从来宾和来自主机的来宾ping主机,因此可以连接到互联网 .

我已卸载并重新安装Workstation 9.未分级到工作站10.重建CentOS 6.5服务器 . 似乎没有什么能解决这个问题 .

当我从Windows 8升级到Windows 8.1时,我安装了VMWare . 后来我发现我应该在升级之前卸载VMWare . 这可能搞砸了我的VMWare网络适配器吗?

有人有主意吗?

11 回答

  • 0

    yum update -y 之前添加以下内容帮助我解决了问题:

    yum clean all
    echo "http://vault.centos.org/5.11/os/x86_64/" > /var/cache/yum/base/mirrorlist.txt
    echo "http://vault.centos.org/5.11/extras/x86_64/" > /var/cache/yum/extras/mirrorlist.txt
    echo "http://vault.centos.org/5.11/updates/x86_64/" > /var/cache/yum/updates/mirrorlist.txt
    

    顺便说一句,CentOS 5已经达到了EOL

  • 2

    检查您是否能够ping外部网站,例如www.google.com . 如果不是插入行:

    nameserver 208.67.222.222
    nameserver 208.67.220.220
    

    在/etc/resolve.conf中

    也在/etc/yum.repos.d/CentOS-Base.repo中

    取消注释所有的镜像列表并注释掉所有的baseurl

    如果mirrorlist不适合您,您可以只尝试baseurl .

    希望能帮助到你!!

  • 1

    请确保您可以ping vault.centos.org .

    然后编辑 /etc/yum.repos.d/CentOS-Base.repo

    注释 mirrorlist 并取消注释 baseurl

    改变一切

    baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
    

    baseurl=http://vault.centos.org/$releasever/centosplus/$basearch/
    

    并享受你的yum更新! ;)

  • 0

    我认为此错误消息的另一个原因是您的版本不再受支持 . 这个帖子中没有任何建议对我有用,我的互联网连接很好,但后来我才意识到我正在运行Centos 5(我知道,古老......),它在2017年3月31日到达了它的生命周期 - 当yum repo错误开始出现时 .

  • 0

    这发生在我在远程网络上支持的系统上,我确定这是由于客户的Check Point防火墙干扰了正常的HTTP流量 . 我跑了 sudo tcpdump -nn -c 500 -s0 -X port 80 并看着yum被重定向到某种门户网站:

    Location: http://x.x.x.x/UserCheck/PortalMain?....
    

    有趣的是,很难用 curl 重现,它可以毫无问题地检索镜像列表 . 我发现我必须添加 User-agent: urlgrabber/3.1.0 yum/3.2.22 用于触发Check Point干扰的 User-agent: urlgrabber/3.1.0 yum/3.2.22 HTTP标头,如下所示:

    $ curl -i \
        -H 'User-agent: urlgrabber/3.1.0 yum/3.2.22' \
        'http://108.61.16.227/?release=5&arch=x86_64&repo=os'
    HTTP/1.1 307 Temporary Redirect
    Location: http://x.x.x.x/UserCheck/PortalMain?IID=....origUrl=....
    Connection: close
    

    Googling for UserCheck/PortalMain显示这是Check Point防火墙 . 我在那里模糊的IP( x.x.x.x )属于客户 . 这足以证明告诉客户他需要对防火墙进行某种更改以允许我的系统畅通无阻的互联网访问(我不知道是什么,但我希望他和/或他的网络团队可以解决它) .

  • 4

    上面的@Steve Kehlet的回答让我找到了这个Q&A搜索相同症状的正确路径 . 更一般地说,答案结果是任何类型的过滤Web代理(在公司环境中经常使用)可以在重定向yum的“http”请求时导致这种情况 . 在许多这种情况下,供应商提供某种“Web代理”(特定于每个特定的防火墙/过滤实现 - 询问您的系统管理员) .

    到目前为止,这个答案中没有提到的重要部分是,您可以通过将以下行添加到 /etc/yum.conf ,使CentOS yum与此代理一起工作

    proxy=http://proxy.yoursite.whatever:port_num

    这将让yum知道如何使用您公司的代理,并修复不直观的“所有镜像网址都没有使用...”错误

  • 0

    对于centos 5.4,你可以像这样改变 /etc/yum.repos.d/CentOS-Base.repo .

    [base]
    name=CentOS-5.4 - Base
    #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=os
    baseurl=http://vault.centos.org/5.4/os/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    
    #released updates 
    [updates]
    name=CentOS-5.4 - Updates
    #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=updates
    baseurl=http://vault.centos.org/5.4/updates/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    
    #packages used/produced in the build but not released
    [addons]
    name=CentOS-5.4 - Addons
    #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=addons
    baseurl=http://vault.centos.org/5.4/addons/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    
    #additional packages that may be useful
    [extras]
    name=CentOS-5.4 - Extras
    #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=extras
    baseurl=http://vault.centos.org/5.4/extras/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-5.4 - Plus
    #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=centosplus
    baseurl=http://vault.centos.org/5.4/centosplus/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    
    #contrib - packages by Centos Users
    [contrib]
    name=CentOS-5.4 - Contrib
    #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=contrib
    baseurl=http://vault.centos.org/5.4/contrib/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    
  • 2

    你可以做两件事:

    • 转到/ etc / sysconfig / network-scripts /并验证您的接口文件,例如ifcfg-eth0 . 将"NM_CONTROLLED"从"yes"更改为"no" . 重启网络 .

    • 转到/ etc / sysconfig / network-scripts /并编辑ifcfg-eth0 . 添加DNS1 = 8.8.8.8和DNS2 = . 第一个条目是Google Public DNS . 重启网络 .

    其中一个应该解决您的问题 .

    此外,如果您尚未执行此操作,请返回原始/etc/yum.repos.d/CentOS-Base.repo文件 .

  • 20

    在/etc/yum.conf中注释掉metadata_expire指令并执行yum clean all . 这对我有用 . 不确定如何 .

  • 0

    [root @ server1~] #yum update已加载的插件:fastermirror,refresh-packagekit,security设置更新进程从缓存的主机文件加载镜像速度YumRepo错误:所有镜像URL都不使用ftp,http [s]或文件 . 例如 . 没有有效镜像的echo / remove mirrorlist:/var/cache/yum/x86_64/6/base/mirrorlist.txt错误:无法为repo找到有效的baseurl:base

    • 答案

    如果您看到上述错误首先意味着您需要检查互联网是否正常工作(ping 8.8.8.8),如果互联网正常工作意味着您可以调试,否则请检查您的防火墙并获取互联网 .

  • 10

    我遇到了与 CentOS 5.11 相同的问题,这里完整的解决方案文件我最终得到: -

    nano /etc/yum.repos.d/CentOS-Base.repo
    

    `

    # CentOS-Base.repo
    # The mirror system uses the connecting IP address of the client and the
    # update status of each mirror to pick mirrors that are updated to and
    # geographically close to the client.  You should use this for CentOS updates
    # http://vault.centos.org/5.11/
    # http://vault.centos.org/5.11/updates/
    # If the mirrorlist= does not work for you, as a fall back you can try the 
    # remarked out baseurl= line instead.
    
    [base]
    name=CentOS-$releasever - Base
    baseurl=http://vault.centos.org/5.11/centosplus/$basearch/
    
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    
    
    #released updates 
    [updates]
    name=CentOS-$releasever - Updates
    
    baseurl=http://vault.centos.org/5.11/updates//$basearch/
    
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    
    
    #additional packages that may be useful
    [extras]
    name=CentOS-$releasever - Extras
    
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
    baseurl=http://vault.centos.org/5.11/extras/$basearch/
    
    
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    
    #additional packages that extend functionality of existing packages
    
    
    [centosplus]
    name=CentOS-$releasever - Plus
    baseurl=http://vault.centos.org/5.11/centosplus/$basearch/
    
    
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    
    #contrib - packages by Centos Users
    [contrib]
    name=CentOS-$releasever - Contrib
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
    #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
    
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
    

相关问题