admin管理员组

文章数量:1618726

问题再现

近期在学习Linux,发现在学习yum时,进行一些必要操作,总会出现该错误。
failure: repodata/repomd.xml from local: [Errno 256] No more mirrors to try. file:///mnt/ios/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/ios/repodata/repomd.xml"

解决

删除老的仓库

rm /etc/yum.repos.d/*.*

卸载yum

 [root@centos7-9-2009-zsc yum.repos.d]# rpm -qa yum yum
yum-3.4.3-168.el7.centos.noarch
[root@centos7-9-2009-zsc yum.repos.d]# rpm -qa yum yum-3.4.3-168.el7.centos.noarch
yum-3.4.3-168.el7.centos.noarch
[root@centos7-9-2009-zsc yum.repos.d]# rpm -qa | grep yum | xargs rpm -e --nodeps
警告:/etc/yum/pluginconf.d/langpacks.conf 已另存为 /etc/yum/pluginconf.d/langpacks.conf.rpmsave
[root@centos7-9-2009-zsc yum.repos.d]# rpm -qa yum yum-3.4.3-168.el7.centos.noarch
[root@centos7-9-2009-zsc yum.repos.d]# rpm -qa | grep yum | xargs rpm -e --nodeps
rpm:未给出要擦除的软件包
[root@centos7-9-2009-zsc yum.repos.d]# rpm -qa yum
[root@centos7-9-2009-zsc yum.repos.d]# ls
[root@centos7-9-2009-zsc yum.repos.d]# 

rpm -qa yum没有提示表明已删除

下载rpm包

可下载最新的。

[root@centos7-9-2009-zsc ~]# ls anaconda-ks.cfg       myresult 
yum-3.4.3-168.el7.centos.noarch.rpm         
yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm  模板  图片  下载  桌面
initial-setup-ks.cfg  print    
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm  公共                       
视频  文档  音乐 

下载地址

下载地址

下载内容

下载三项:

并将其传至centOS

接下来,进行安装rpm

rpm -ivh yum-*

进行检查(养成好习惯)

检查方式二

导入证书

[root@centos7-9-2009-zsc ~]# rpm --import http://mirror.centos/centos/RPM-GPG-KEY-CentOS-7

配置阿里源

[root@centos7-9-2009-zsc ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun/repo/Centos-7.repo
--2022-10-23 10:16:39--  http://mirrors.aliyun/repo/Centos-7.repo
正在解析主机 mirrors.aliyun (mirrors.aliyun)... 27.128.147.239, 27.128.147.234, 27.128.147.237, ...
正在连接 mirrors.aliyun (mirrors.aliyun)|27.128.147.239|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2523 (2.5K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”

100%[===============================================================================================================================================>] 2,523       --.-K/s 用时 0s      

2022-10-23 10:16:39 (920 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2523/2523])

下一步,进行清缓存

[root@centos7-9-2009-zsc ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: base extras updates
Cleaning up list of fastest mirrors

最后生成/制作出新的缓存

[root@centos7-9-2009-zsc ~]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun
 * extras: mirrors.aliyun
 * updates: mirrors.aliyun
http://mirrors.aliyuncs/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs:80; 拒绝连接"
正在尝试其它镜像。
http://mirrors.cloud.aliyuncs/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs; 未知的错误"
正在尝试其它镜像。
base                                                                                                                                                              | 3.6 kB  00:00:00     
extras                                                                                                                                                            | 2.9 kB  00:00:00     
updates                                                                                                                                                           | 2.9 kB  00:00:00     
(1/10): base/7/x86_64/group_gz                                                                                                                                    | 153 kB  00:00:00     
(2/10): base/7/x86_64/primary_db                                                                                                                                  | 6.1 MB  00:00:06     
(3/10): extras/7/x86_64/primary_db                                                                                                                                | 249 kB  00:00:00     
(4/10): extras/7/x86_64/filelists_db                                                                                                                              | 276 kB  00:00:00     
(5/10): extras/7/x86_64/other_db                                                                                                                                  | 149 kB  00:00:00     
(6/10): base/7/x86_64/other_db                                                                                                                                    | 2.6 MB  00:00:02     
(7/10): updates/7/x86_64/filelists_db                                                                                                                             | 9.6 MB  00:00:10     
(8/10): updates/7/x86_64/other_db                                                                                                                                 | 1.2 MB  00:00:01     
(9/10): base/7/x86_64/filelists_db                                                                                                                                | 7.2 MB  00:00:23     
(10/10): updates/7/x86_64/primary_db                                                                                                                              |  17 MB  00:00:18     
元数据缓存已建立

以上步骤操作完成后,我们进行前后对比

就不会再报错啦~~~

重新安装后

之前报错~~~

对比
[root@centos7-9-2009-zsc ~]# yum check-update -y dialog
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
file:///mnt/ios/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/ios/repodata/repomd.xml"
正在尝试其它镜像。


 One of the configured repositories failed (local),
 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=local ...

     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 local
        or
            subscription-manager repos --disable=local

     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=local.skip_if_unavailable=true

failure: repodata/repomd.xml from local: [Errno 256] No more mirrors to try.
file:///mnt/ios/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/ios/repodata/repomd.xml"

failure: repodata/repomd.xml from local: [Errno 256] No more mirrors to try. file:///mnt/ios/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/ios/repodata/repomd.xml"

[root@centos7-9-2009-zsc ~]# yum check-update -y dialog
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun
 * extras: mirrors.aliyun
 * updates: mirrors.aliyun
[root@centos7-9-2009-zsc ~]# 

已加载插件:fastestmirror Loading mirror speeds from cached hostfile
*base: mirrors.aliyun
*extras: mirrors.aliyun
*updates: mirrors.aliyun

这次错误学习纠正就到这里啦~

我们下次再见 最后别忘记点赞关注+收藏呀~~

本文标签: 错误failurerepodataLinuxCentos