解決CentOS7用yum安裝軟件顯示錯誤:cannot find a valid baseurl for repo: base/7/x86_64

 

使用yun安裝軟件時有時會報repo文件的錯誤,, 主要問題出自於CentOS-Base.repo文件html

 

解決方案:將這個文件後綴名修改使這個文件無效docker

[root@localhost ~]# cd /etc/yum.repos.d/segmentfault

[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bakcentos

[root@localhost yum.repos.d]# ls
CentOS-Base.repo.bak  CentOS-Debuginfo.repo    CentOS-Media.repo       CentOS-Vault.repo
CentOS-CR.repo            CentOS-fasttrack.repo      CentOS-Sources.repopromise

 

 

接下來能夠繼續進行yum的安裝app

===================================================================================this

 

Centos7系統安裝yum遇到的問題failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try. http:
原創果凍先生的專欄 最後發佈於2018-06-10 17:50:03 閱讀數 45807 收藏
展開
當遇到這個問題的時候,發現網上也有不少人也在問一樣的問題。可是發現你們問的問題,不多有人能解釋得很清楚,並且不少人的解決方法複雜且不能解決問題。我查了近二十篇博客和文章,對照作了,可是基本解決不了問題。url

 

http://mirrors.ustc.edu.cn/help/centos.htmlspa

 

http://mirrors.163.com/.help/centos.html.net

 

https://blog.csdn.net/dreamchasering/article/details/77160477

 

https://blog.csdn.net/shaoqiufeng/article/details/78785806

 

https://blog.csdn.net/orangleliu/article/details/40588799

 

https://www.cnblogs.com/yizhichun/p/6339742.html

 

https://blog.csdn.net/james_jr10/article/details/78357600(這個好像很厲害,可是寫得不清晰,誤我前程啊)

 

https://segmentfault.com/q/1010000000716991/a-1020000000717340

 

你來看看,這些問題有多少人問?可是能解決實際問題的卻不多!!!

 

 

 

下面由我給出一種最簡單最有效的方法。耐心看下去哦!

 

問題所在:

 

[root@cit-server6-s1-372 yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
base | 5.6 kB 00:00:00
http://mirrors.163.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno -1] Error importing repomd.xml for base: Damaged repomd.xml file
Trying other mirror.

 


One of the configured repositories failed (CentOS-7 - Base - 163.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. Disable the repository, 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

 

4. 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.163.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno -1] Error importing repomd.xml for base: Damaged repomd.xml file
[root@cit-server6-s1-372 yum.repos.d]#
錯誤所在的問題: 

 

主要問題在於yum源問題。

 

下面開始解決問題:

 

 

 

4.下載yum依賴包

[root@localhost ~]# wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
--2020-02-09 16:01:35-- http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
正在解析主機 vault.centos.org (vault.centos.org)... 208.100.23.71
正在鏈接 vault.centos.org (vault.centos.org)|208.100.23.71|:80... 已鏈接。
已發出 HTTP 請求,正在等待迴應... 200 OK
長度:30600 (30K) [application/x-rpm]
正在保存至: 「yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm」

100%[==================================================================================================================>] 30,600 6.47KB/s 用時 4.6s

2020-02-09 16:01:40 (6.47 KB/s) - 已保存 「yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm」 [30600/30600])

[root@localhost ~]# wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
--2020-02-09 16:01:43-- http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
正在解析主機 vault.centos.org (vault.centos.org)... 208.100.23.71
正在鏈接 vault.centos.org (vault.centos.org)|208.100.23.71|:80... 已鏈接。
已發出 HTTP 請求,正在等待迴應... 200 OK
長度:28348 (28K) [application/x-rpm]
正在保存至: 「yum-metadata-parser-1.1.4-10.el7.x86_64.rpm」

100%[==================================================================================================================>] 28,348 2.16KB/s 用時 6.4s

2020-02-09 16:01:50 (4.34 KB/s) - 已保存 「yum-metadata-parser-1.1.4-10.el7.x86_64.rpm」 [28348/28348])

[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm 模板 圖片 下載 桌面
core.8499 yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 公共 視頻 文檔 音樂
[root@localhost ~]# mv yum-* /etc/yum.
yum.conf yum.repos.d/
[root@localhost ~]# mv yum-* /etc/yum.repos.d/
[root@localhost ~]# ls
anaconda-ks.cfg core.8499 initial-setup-ks.cfg 公共 模板 視頻 圖片 文檔 下載 音樂 桌面
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
a Centos-7.repo docker-ce.repo local.repo yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
[root@localhost yum.repos.d]# rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
準備中... ################################# [100%]
軟件包 yum-metadata-parser-1.1.4-10.el7.x86_64 已經安裝
[root@localhost yum.repos.d]# rpm -ivh yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
準備中... ################################# [100%]
軟件包 yum-plugin-fastestmirror-1.1.31-50.el7.noarch (比 yum-plugin-fastestmirror-1.1.31-34.el7.noarch 還要新) 已經安裝
file /usr/lib/yum-plugins/fastestmirror.py from install of yum-plugin-fastestmirror-1.1.31-34.el7.noarch conflicts with file from package yum-plugin-fastestmirror-1.1.31-50.el7.noarch
file /usr/lib/yum-plugins/fastestmirror.pyc from install of yum-plugin-fastestmirror-1.1.31-34.el7.noarch conflicts with file from package yum-plugin-fastestmirror-1.1.31-50.el7.noarch
file /usr/lib/yum-plugins/fastestmirror.pyo from install of yum-plugin-fastestmirror-1.1.31-34.el7.noarch conflicts with file from package yum-plugin-fastestmirror-1.1.31-50.el7.noarch
[root@localhost yum.repos.d]# ls
a Centos-7.repo docker-ce.repo local.repo yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
[root@localhost yum.repos.d]# cd a/
[root@localhost a]# ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo
[root@localhost a]# cp CentOS-Base.repo CentOS-Base.repo.bak
[root@localhost a]# mv CentOS-Base.repo ../
[root@localhost a]# cd ../
[root@localhost yum.repos.d]# ls
a CentOS-Base.repo local.repo yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
Centos-7.repo docker-ce.repo yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost yum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

 [root@localhost yum.repos.d]# yum clean all

[root@localhost yum.repos.d]# yum makecache 

相關文章
相關標籤/搜索