Linux使用yum时报错:One of the configured repositories failed (CentOS-7 - Base - mirrors.aliyun.com)等

这几天在学习yum的时候报错,尝试了很多办法,包括换镜像阿里云、163等的云,或者干脆先在Windows下载.repo文件再共享到Linux虚拟机再使用yum依然报错,而且错误越来越多,大概有以下几种:
错误1:[Errno -1] Error importing repomd.xml for base: Damaged repomd.xml file
错误2:[Errno 14] curl#6 - “Could not resolve host: mirrors.cloud.aliyuncs.com; 未知的错误”
错误3:One of the configured repositories failed (CentOS-7 - Base - mirrors.aliyun.com),and yum doesn’t have enough cached data to continue.

在查找了许多资料后,确定了以上这些错误发生的原因:Linux无法连接到外网
但是我的Linux明明可以ping通外网,却还是不行。
折磨了许久之后,重点来了:ping通外网不代表可以进行下载,如果你的网络是需要验证的话,是无法进行下载的!!!
因为我是在学校学习的,连的是校园网,而校园网是需要验证所以Linux无法进行下载!!

所以解决上述问题的方法是:

  1. 确保你的网络可以ping通外网
  2. 确保你的网络不需要上网验证,否则换一个网络
[root@master yum.repos.d]# [root@master yum.repos.d]# cat > /etc/yum.repos.d/CentOS-Base.repo << 'EOF' > [base] > name=CentOS-$releasever - Base > baseurl=https://mirrors.aliyun.com.centos/7/os/$basearch/ > gpgcheck=1 > gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 > > [updates] > name=CentOS-$releasever - Updates > baseurl=https://mirrors.aliyun.com.centos/7/updates/$basearch/ > gpgcheck=1 > gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 > > [extras] > name=CentOS-$releasever - Extras > baseurl=https://mirrors.aliyun.com.centos/7/extras/$basearch/ > gpgcheck=1 > gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 > > [centosplus] > name=CentOS-$releasever - Plus > baseurl=https://mirrors.aliyun.com.centos/7/centosplus/$basearch/ > gpgcheck=1 > enabled=0 > gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 > EOF [root@master yum.repos.d]# yum clean all 已加载插件:fastestmirror 正在清理软件源: base extras local updates Cleaning up list of fastest mirrors [root@master yum.repos.d]# yum makecache 已加载插件:fastestmirror Determining fastest mirrors https://mirrors.aliyun.com.centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com.centos; 未知的错误" 正在尝试其它镜像。 One of the configured repositories failed (CentOS-7 - Base), 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=base ... 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 base or subscription-manager repos --disable=base 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=base.skip_if_unavailable=true failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try. https://mirrors.aliyun.com.centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com.centos; 未知的错误" [root@master yum.repos.d]# yum install telnet -y 已加载插件:fastestmirror Loading mirror speeds from cached hostfile https://mirrors.aliyun.com.centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com.centos; 未知的错误" 正在尝试其它镜像。 One of the configured repositories failed (CentOS-7 - Base), 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=base ... 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 base or subscription-manager repos --disable=base 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=base.skip_if_unavailable=true failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try. https://mirrors.aliyun.com.centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com.centos; 未知的错误" [root@master yum.repos.d]# yum install nmap-ncat -y # nc 命令属于 nmap-ncat 包 已加载插件:fastestmirror Loading mirror speeds from cached hostfile https://mirrors.aliyun.com.centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com.centos; 未知的错误" 正在尝试其它镜像。 One of the configured repositories failed (CentOS-7 - Base), 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=base ... 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 base or subscription-manager repos --disable=base 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=base.skip_if_unavailable=true failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try. https://mirrors.aliyun.com.centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com.centos; 未知的错误" [root@master yum.repos.d]# yum install telnet -y 已加载插件:fastestmirror Loading mirror speeds from cached hostfile https://mirrors.aliyun.com.centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com.centos; 未知的错误" 正在尝试其它镜像。 One of the configured repositories failed (CentOS-7 - Base), 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=base ... 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 base or subscription-manager repos --disable=base 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=base.skip_if_unavailable=true failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try. https://mirrors.aliyun.com.centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com.centos; 未知的错误" [root@master yum.repos.d]# yum install nmap-ncat -y # nc 命令属于 nmap-ncat 包 已加载插件:fastestmirror Loading mirror speeds from cached hostfile https://mirrors.aliyun.com.centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com.centos; 未知的错误" 正在尝试其它镜像。 One of the configured repositories failed (CentOS-7 - Base), 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=base ... 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 base or subscription-manager repos --disable=base 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=base.skip_if_unavailable=true failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try. https://mirrors.aliyun.com.centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com.centos; 未知的错误" [root@master yum.repos.d]# jps # 查看是否有其他 Java 进程占用 55363 Application 26794 Jps [root@master yum.repos.d]# lsof -i :44444 # 查看 44444 端口是 否被占用 bash: lsof: 未找到命令 [root@master yum.repos.d]# kill -9 <PID> # 杀掉占用进程(谨慎操作) bash: 未预期的符号 `newline' 附近有语法错误 [root@master yum.repos.d]# nc localhost 44444 bash: nc: 未找到命令 [root@master yum.repos.d]#
最新发布
12-30
[root@server-0001 yum.repos.d]# cat /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 # unless you are manually picking other mirrors. # # 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 - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/7.9.2009/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 [root@server-0001 yum.repos.d]#[root@server-0001 yum.repos.d]# yum makecache fast Loaded plugins: fastestmirror Determining fastest mirrors * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com http://mirrors.aliyun.com/centos-vault/7.9.2009/os/aarch64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found Trying other mirror. To address this issue please refer to the below wiki article https://wiki.centos.org/yum-errors If above article doesn't help to resolve this issue please use https://bugs.centos.org/. One of the configured repositories failed (CentOS-7 - Base - mirrors.aliyun.com), 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=base ... 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 base or subscription-manager repos --disable=base 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=base.skip_if_unavailable=true failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try. http://mirrors.aliyun.com/centos-vault/7.9.2009/os/aarch64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found [root@server-0001 yum.repos.d]#
09-27
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值