环境: CentOS7(ISO映像文件 = CentOS-7-x86_64-DVD-2009.iso)
解决思路: 系统repo镜像源连接问题 导致 执行失败, 切换repo为国内源即可
# 切换仓库镜像源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
# 或者
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
过程:
[root@localhost /]# ping wwww.baidu.com
PING ps_other.a.shifen.com (110.242.68.66) 56(84) bytes of data.
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=128 time=56.7 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=3 ttl=128 time=62.0 ms
^C
--- ps_other.a.shifen.com ping statistics ---
3 packets transmitted, 2 received, 33% packet loss, time 2004ms
rtt min/avg/max/mdev = 56.730/59.414/62.098/2.684 ms
[root@localhost /]# # 测试得环境可正常访问国内网络
[root@localhost ~]# yum update
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
One of the configured repositories failed (未知),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base
[root@localhost yum.repos.d]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# ll
总用量 40
-rw-r--r--. 1 root root 1668 7月 26 15:07 CentOS-Base.repo.backup
-rw-r--r--. 1 root root 1309 10月 23 2020 CentOS-CR.repo
-rw-r--r--. 1 root root 649 10月 23 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 10月 23 2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 10月 23 2020 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 10月 23 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 8515 10月 23 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root 616 10月 23 2020 CentOS-x86_64-kernel.repo
[root@localhost yum.repos.d]# # 查询 所有可用软件仓库 信息
[root@localhost yum.repos.d]# yum repolist all
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
源标识 源名称 状态
C7.0.1406-base/x86_64 CentOS-7.0.1406 - Base 禁用
C7.0.1406-centosplus/x86_64 CentOS-7.0.1406 - CentOSPlus 禁用
C7.0.1406-extras/x86_64 CentOS-7.0.1406 - Extras 禁用
C7.0.1406-fasttrack/x86_64 CentOS-7.0.1406 - Fasttrack 禁用
C7.0.1406-updates/x86_64 CentOS-7.0.1406 - Updates 禁用
C7.1.1503-base/x86_64 CentOS-7.1.1503 - Base 禁用
C7.1.1503-centosplus/x86_64 CentOS-7.1.1503 - CentOSPlus 禁用
C7.1.1503-extras/x86_64 CentOS-7.1.1503 - Extras 禁用
C7.1.1503-fasttrack/x86_64 CentOS-7.1.1503 - Fasttrack 禁用
C7.1.1503-updates/x86_64 CentOS-7.1.1503 - Updates 禁用
C7.2.1511-base/x86_64 CentOS-7.2.1511 - Base 禁用
C7.2.1511-centosplus/x86_64 CentOS-7.2.1511 - CentOSPlus 禁用
C7.2.1511-extras/x86_64 CentOS-7.2.1511 - Extras 禁用
C7.2.1511-fasttrack/x86_64 CentOS-7.2.1511 - Fasttrack 禁用
C7.2.1511-updates/x86_64 CentOS-7.2.1511 - Updates 禁用
C7.3.1611-base/x86_64 CentOS-7.3.1611 - Base 禁用
C7.3.1611-centosplus/x86_64 CentOS-7.3.1611 - CentOSPlus 禁用
C7.3.1611-extras/x86_64 CentOS-7.3.1611 - Extras 禁用
C7.3.1611-fasttrack/x86_64 CentOS-7.3.1611 - Fasttrack 禁用
C7.3.1611-updates/x86_64 CentOS-7.3.1611 - Updates 禁用
C7.4.1708-base/x86_64 CentOS-7.4.1708 - Base 禁用
C7.4.1708-centosplus/x86_64 CentOS-7.4.1708 - CentOSPlus 禁用
C7.4.1708-extras/x86_64 CentOS-7.4.1708 - Extras 禁用
C7.4.1708-fasttrack/x86_64 CentOS-7.4.1708 - Fasttrack 禁用
C7.4.1708-updates/x86_64 CentOS-7.4.1708 - Updates 禁用
C7.5.1804-base/x86_64 CentOS-7.5.1804 - Base 禁用
C7.5.1804-centosplus/x86_64 CentOS-7.5.1804 - CentOSPlus 禁用
C7.5.1804-extras/x86_64 CentOS-7.5.1804 - Extras 禁用
C7.5.1804-fasttrack/x86_64 CentOS-7.5.1804 - Fasttrack 禁用
C7.5.1804-updates/x86_64 CentOS-7.5.1804 - Updates 禁用
C7.6.1810-base/x86_64 CentOS-7.6.1810 - Base 禁用
C7.6.1810-centosplus/x86_64 CentOS-7.6.1810 - CentOSPlus 禁用
C7.6.1810-extras/x86_64 CentOS-7.6.1810 - Extras 禁用
C7.6.1810-fasttrack/x86_64 CentOS-7.6.1810 - Fasttrack 禁用
C7.6.1810-updates/x86_64 CentOS-7.6.1810 - Updates 禁用
C7.7.1908-base/x86_64 CentOS-7.7.1908 - Base 禁用
C7.7.1908-centosplus/x86_64 CentOS-7.7.1908 - CentOSPlus 禁用
C7.7.1908-extras/x86_64 CentOS-7.7.1908 - Extras 禁用
C7.7.1908-fasttrack/x86_64 CentOS-7.7.1908 - Fasttrack 禁用
C7.7.1908-updates/x86_64 CentOS-7.7.1908 - Updates 禁用
C7.8.2003-base/x86_64 CentOS-7.8.2003 - Base 禁用
C7.8.2003-centosplus/x86_64 CentOS-7.8.2003 - CentOSPlus 禁用
C7.8.2003-extras/x86_64 CentOS-7.8.2003 - Extras 禁用
C7.8.2003-fasttrack/x86_64 CentOS-7.8.2003 - Fasttrack 禁用
C7.8.2003-updates/x86_64 CentOS-7.8.2003 - Updates 禁用
base-debuginfo/x86_64 CentOS-7 - Debuginfo 禁用
base-source/7 CentOS-7 - Base Sources 禁用
c7-media CentOS-7 - Media 禁用
centos-kernel/7/x86_64 CentOS LTS Kernels for x86_64 禁用
centos-kernel-experimental/7/x86_64 CentOS Experimental Kernels for x86_64 禁用
centosplus-source/7 CentOS-7 - Plus Sources 禁用
cr/7/x86_64 CentOS-7 - cr 禁用
extras-source/7 CentOS-7 - Extras Sources 禁用
fasttrack/7/x86_64 CentOS-7 - fasttrack 禁用
updates-source/7 CentOS-7 - Updates Sources 禁用
repolist: 0
root@localhost yum.repos.d]# # 换源
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
-bash: wget: 未找到命令
[root@localhost yum.repos.d]# which wget
[root@localhost yum.repos.d]# :<<'END'
> # shell多行注释
> 当前环境没安装wget, 且当前无法使用yum下载wget(repo与wegt形成 闭环互嵌 未安装)
> 虚拟机使用镜像文件CentOS-7-x86_64-DVD-2009进行初始化, 并未预装wget
> => 利用curl命令执行( 注意大小写)
> END
[root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2523 100 2523 0 0 11990 0 --:--:-- --:--:-- --:--:-- 12014
[root@localhost yum.repos.d]# yum repolist all
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
源标识 源名称 状态
C7.0.1406-base/x86_64 CentOS-7.0.1406 - Base 禁用
C7.0.1406-centosplus/x86_64 CentOS-7.0.1406 - CentOSPlus 禁用
C7.0.1406-extras/x86_64 CentOS-7.0.1406 - Extras 禁用
C7.0.1406-fasttrack/x86_64 CentOS-7.0.1406 - Fasttrack 禁用
C7.0.1406-updates/x86_64 CentOS-7.0.1406 - Updates 禁用
C7.1.1503-base/x86_64 CentOS-7.1.1503 - Base 禁用
C7.1.1503-centosplus/x86_64 CentOS-7.1.1503 - CentOSPlus 禁用
C7.1.1503-extras/x86_64 CentOS-7.1.1503 - Extras 禁用
C7.1.1503-fasttrack/x86_64 CentOS-7.1.1503 - Fasttrack 禁用
C7.1.1503-updates/x86_64 CentOS-7.1.1503 - Updates 禁用
C7.2.1511-base/x86_64 CentOS-7.2.1511 - Base 禁用
C7.2.1511-centosplus/x86_64 CentOS-7.2.1511 - CentOSPlus 禁用
C7.2.1511-extras/x86_64 CentOS-7.2.1511 - Extras 禁用
C7.2.1511-fasttrack/x86_64 CentOS-7.2.1511 - Fasttrack 禁用
C7.2.1511-updates/x86_64 CentOS-7.2.1511 - Updates 禁用
C7.3.1611-base/x86_64 CentOS-7.3.1611 - Base 禁用
C7.3.1611-centosplus/x86_64 CentOS-7.3.1611 - CentOSPlus 禁用
C7.3.1611-extras/x86_64 CentOS-7.3.1611 - Extras 禁用
C7.3.1611-fasttrack/x86_64 CentOS-7.3.1611 - Fasttrack 禁用
C7.3.1611-updates/x86_64 CentOS-7.3.1611 - Updates 禁用
C7.4.1708-base/x86_64 CentOS-7.4.1708 - Base 禁用
C7.4.1708-centosplus/x86_64 CentOS-7.4.1708 - CentOSPlus 禁用
C7.4.1708-extras/x86_64 CentOS-7.4.1708 - Extras 禁用
C7.4.1708-fasttrack/x86_64 CentOS-7.4.1708 - Fasttrack 禁用
C7.4.1708-updates/x86_64 CentOS-7.4.1708 - Updates 禁用
C7.5.1804-base/x86_64 CentOS-7.5.1804 - Base 禁用
C7.5.1804-centosplus/x86_64 CentOS-7.5.1804 - CentOSPlus 禁用
C7.5.1804-extras/x86_64 CentOS-7.5.1804 - Extras 禁用
C7.5.1804-fasttrack/x86_64 CentOS-7.5.1804 - Fasttrack 禁用
C7.5.1804-updates/x86_64 CentOS-7.5.1804 - Updates 禁用
C7.6.1810-base/x86_64 CentOS-7.6.1810 - Base 禁用
C7.6.1810-centosplus/x86_64 CentOS-7.6.1810 - CentOSPlus 禁用
C7.6.1810-extras/x86_64 CentOS-7.6.1810 - Extras 禁用
C7.6.1810-fasttrack/x86_64 CentOS-7.6.1810 - Fasttrack 禁用
C7.6.1810-updates/x86_64 CentOS-7.6.1810 - Updates 禁用
C7.7.1908-base/x86_64 CentOS-7.7.1908 - Base 禁用
C7.7.1908-centosplus/x86_64 CentOS-7.7.1908 - CentOSPlus 禁用
C7.7.1908-extras/x86_64 CentOS-7.7.1908 - Extras 禁用
C7.7.1908-fasttrack/x86_64 CentOS-7.7.1908 - Fasttrack 禁用
C7.7.1908-updates/x86_64 CentOS-7.7.1908 - Updates 禁用
C7.8.2003-base/x86_64 CentOS-7.8.2003 - Base 禁用
C7.8.2003-centosplus/x86_64 CentOS-7.8.2003 - CentOSPlus 禁用
C7.8.2003-extras/x86_64 CentOS-7.8.2003 - Extras 禁用
C7.8.2003-fasttrack/x86_64 CentOS-7.8.2003 - Fasttrack 禁用
C7.8.2003-updates/x86_64 CentOS-7.8.2003 - Updates 禁用
C7.9.2009-base/x86_64 CentOS-7.9.2009 - Base 禁用
C7.9.2009-centosplus/x86_64 CentOS-7.9.2009 - CentOSPlus 禁用
C7.9.2009-extras/x86_64 CentOS-7.9.2009 - Extras 禁用
C7.9.2009-fasttrack/x86_64 CentOS-7.9.2009 - Fasttrack 禁用
C7.9.2009-updates/x86_64 CentOS-7.9.2009 - Updates 禁用
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 启用: 10,072
base-debuginfo/x86_64 CentOS-7 - Debuginfo 禁用
base-source/7 CentOS-7 - Base Sources 禁用
c7-media CentOS-7 - Media 禁用
centos-kernel/7/x86_64 CentOS LTS Kernels for x86_64 禁用
centos-kernel-experimental/7/x86_64 CentOS Experimental Kernels for x86_64 禁用
centosplus/7/x86_64 CentOS-7 - Plus - mirrors.aliyun.com 禁用
centosplus-source/7 CentOS-7 - Plus Sources 禁用
contrib/7/x86_64 CentOS-7 - Contrib - mirrors.aliyun.com 禁用
cr/7/x86_64 CentOS-7 - cr 禁用
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 启用: 526
extras-source/7 CentOS-7 - Extras Sources 禁用
fasttrack/7/x86_64 CentOS-7 - fasttrack 禁用
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 启用: 6,173
updates-source/7 CentOS-7 - Updates Sources 禁用
repolist: 16,771
[root@localhost yum.repos.d]# # base/7/x86_64、extras-source、updates-source/7 分别为CentOS的 基本软件包/额外源代码/更新源代码 仓库, 辅助安装、更新和编译软件
[root@localhost yum.repos.d]# yum install wget
...
Running transaction
正在安装 : wget-1.14-18.el7_6.1.x86_64 1/1
验证中 : wget-1.14-18.el7_6.1.x86_64 1/1
已安装:
wget.x86_64 0:1.14-18.el7_6.1
完毕!
[root@localhost yum.repos.d]# yum update
...
完毕!
标签:x86,CentOS,禁用,configured,repositories,failed,64,yum,root
From: https://www.cnblogs.com/LinForest/p/18326412