我已经在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
虚拟机适用于其他机器(Windows 7
台式机和Windows 8.1
笔记本电脑),只是不是我需要它工作的机器。 我能够从客人那里ping主机,从主机那里ping来宾,因此可以连接到互联网。
我已经卸载并重新安装了工作站 9。未分级到工作站 10。重建 CentOS 6.5 伺服器。似乎没有什么能解决问题。
当我从 Windows 8 升级到 Windows 8.1 时,我安装了 VMWare。 后来我发现我应该在升级之前卸载 VMWare。 这会搞砸我的 VMWare 网络适配器吗?
有人有什么想法吗?
确保你可以 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/
并享受您的百胜更新!! ;)
Centos 6 版本上个月(2020 年 11 月 30 日)达到了停产状态
您可以在/etc/yum.repos.d/CentOS-Base.repo
中使用 centos 列出的非官方镜像之一。在我的情况下(6.10),我使用了镜像 http://mirror.nsc.liu.se/centos-store/6.10/并且运行顺利:
[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.nsc.liu.se/centos-store/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# same for the others [updates] etc in the file
我认为此错误消息的另一个原因是您的版本不再受支持。 这个线程中的任何建议都不适合我,我的互联网连接很好,但后来我意识到我正在运行 Centos 5(我知道,古老的......),它在 2017 年 3 月 31 日达到生命周期结束 - 就在 yum repo 错误开始出现的时候。
对于 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
这发生在我在远程网络上支持的系统上,我确定这是由于客户的检查点防火墙干扰了正常的HTTP流量。我跑了一个sudo tcpdump -nn -c 500 -s0 -X port 80
,看着yum被重定向到某种门户:
Location: http://x.x.x.x/UserCheck/PortalMain?....
有趣的是,很难用curl
重现,它检索镜像列表没有任何问题。我发现我必须添加yum
用来触发检查点干扰的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
谷歌搜索UserCheck/PortalMain显示这是检查点防火墙。而我在那里隐藏的IP(x.x.x.x
)属于客户。这足以证明客户他需要对他的防火墙进行某种更改,以允许我的系统畅通无阻地访问互联网(我不知道是什么,但我希望他和/或他的网络团队能够弄清楚)。
在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
> 2021-01-15 之后的CentOS 6.10
CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/$basearch//RPM-GPG-KEY-CentOS-6
CentOS-fasttrack.repo
[fasttrack]
name=CentOS-6 - fasttrack
baseurl=https://vault.centos.org/6.10/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://vault.centos.org/6.10/$basearch/RPM-GPG-KEY-CentOS-6
CentOS-SCLo-scl.repo
# CentOS-SCLo-sclo.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information
[centos-sclo-sclo]
name=CentOS-6 - SCLo sclo
baseurl=https://vault.centos.org/6.10/sclo/$basearch/sclo/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-testing]
name=CentOS-6 - SCLo sclo Testing
baseurl=https://vault.centos.org/6.10/sclo/$basearch/sclo/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-source]
name=CentOS-6 - SCLo sclo Sources
baseurl=https://vault.centos.org/6.10/sclo/$basearch/sclo/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-debuginfo]
name=CentOS-6 - SCLo sclo Debuginfo
baseurl=https://vault.centos.org/6.10/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_old
vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/6.9/os/$basearch
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
exclude=redhat-logos
yum clean all
yum update -y
Enjoy!!!!
与其他关于/etc/yum.repos.d/CentOS-Base.repo
更新的帖子相同,我还必须修改以下文件中的baseurl值:
sudo vi /etc/yum.repos.d/CentOS-SCLo-scl.repo
sudo vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
您可能需要ls /etc/yum.repos.d/
并查看其中可能需要更新 EOL 发行版的任何其他文件的内容。
另外,但一定要用sudo yum clean all
清除 yum 缓存。
CENTOS 6.10
- 备份文件
/etc/yum.repos.d/CentOS-Base.repo
- 备份后编辑文件并复制以下内容:
[base]
name=CentOS-$releasever - Base
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/$basearch//RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/updates/$basearch//RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/extras/$basearch//RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://vault.centos.org/6.10/centosplus/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/centosplus/$basearch//RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=https://vault.centos.org/6.10/contrib/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/contrib/$basearch//RPM-GPG-KEY-CentOS-6
上面来自@Steve Kehlet的答案让我在发现这个Q&A寻找相同的症状后走上了正确的道路。 更一般地说,答案是任何类型的过滤 Web 代理(经常在 Corp 环境中使用)在重定向 yum 的"http"请求时都可能导致这种情况。 在许多情况下,供应商提供某种"Web代理"(特定于每个特定的防火墙/过滤实现 - 询问您的系统管理员)。
到目前为止,这个答案中没有提到的重要部分是,你可以通过添加以下行到/etc/yum.conf来使 CentOS yum 与这个代理一起工作。
proxy=http://proxy.yoursite.whatever:port_num
这将使 yum 知道如何使用您公司的代理,并修复不直观的"所有镜像 url 都没有使用..."错误
我在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
对于其他陷入过去的人,
从 docker 容器内 centos:centos5
# cat CentOS-Base.repo
[base]
name=CentOS-5.11 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=os
baseurl=http://archive.kernel.org/centos-vault/5.11/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-5.11 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=updates
baseurl=http://archive.kernel.org/centos-vault/5.11/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.11 - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=addons
baseurl=http://archive.kernel.org/centos-vault/5.11/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.11 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=extras
baseurl=http://archive.kernel.org/centos-vault/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-5.11 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=centosplus
baseurl=http://archive.kernel.org/centos-vault/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-5.11 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=contrib
baseurl=http://archive.kernel.org/centos-vault/5.11/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
我还必须更改此libselinux.repo
# cat libselinux.repo
[libselinux]
name=CentOS-$releasever - libselinux
baseurl=http://archive.kernel.org/centos-vault/5.11/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
includepkgs=libselinux*
这里我们只需要在/etc/yum.repos.d/CentOS-Base.repo 中输入正确的 baseurl
检查此 URL http://mirror.cisp.com 浏览您的操作系统并获取该 URL
如果你有 Centos6.10,那么你的基本网址如下
baseurl=http://mirror.cisp.com/CentOS/6.10/
- vim/etc/yum.repos.d/myrepo.repo
- 粘贴以下行:
[centos]
name=CentOS-6.10 - Base
baseurl=http://mirror.nsc.liu.se/centos-store/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
- 保存文件并退出。
- 百胜复仇者。
- 百胜安装网点
检查您是否能够 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。
希望对您有所帮助!!
您可以做两件事:
- 转到/etc/sysconfig/network-scripts/并验证您的接口文件,例如 ifcfg-eth0。将"NM_CONTROLLED"从"是"更改为"否"。重新启动网络。
- 转到/etc/sysconfig/network-scripts/并编辑 ifcfg-eth0。添加 DNS1=8.8.8.8 和 DNS2=。第一个条目是谷歌公共DNS。重新启动网络。
其中之一应该可以解决您的问题。
另外,如果你还没有这样做,请回到原始的/etc/yum.repos.d/CentOS-Base.repo 文件。
注释掉/etc/yum.conf 中的metadata_expire指令并执行 yum 清理所有操作。这对我有用。不知道怎么做。
[root@server1 ~]# 百胜更新 加载的插件:最快的镜像,刷新包套件,安全性 设置更新过程 从缓存的主机文件加载镜像速度 YumRepo错误:所有镜像URL都没有使用ftp,http[s]或文件。 例如。回波/删除没有有效镜像的镜像列表:/var/cache/yum/x86_64/6/base/mirrorlist.txt 错误:找不到存储库的有效基本网址:基本
- 答
如果您看到上述错误意味着首先您需要检查互联网是否正常工作(ping 8.8.8.8),如果互联网正常工作意味着您可以调试否则检查防火墙并获取互联网。