看這篇文章前,先說一下我的實際情況。本來要部署docker服務的,然后yum安裝任何軟件都不起效果,最后通過老師遠程的幫助,最后成功安裝上docker,老師的解決辦法就是忽略這個問題,直接自己配置網絡yum源,然后完美解決(對,沒錯下面的文章內容可以不用看了)。由於機子沒開虛擬化,結果啟動docker服務時報錯。開啟CPU虛擬化后,又出現新的錯誤,docker的oci報錯,oci是docker網絡標准,結果更新系統,重啟機器問題已解決。
使用yum命令安裝軟件時候出現以下錯誤:
Loaded plugins: product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. http://mirrors.163.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found Trying other mirror. One of the configured repositories failed (CentOS-7Server - 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/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
網上說:使用redhat的yum源是需要注冊付費的
1.毫不猶豫卸載RedHat自帶的yum包
# rpm -qa|grep yum|xargs rpm -e --nodeps
[root@localhost yum.repos.d]# rpm -qa|grep yum yum-metadata-parser-1.1.4-10.el7.x86_64 yum-utils-1.1.31-24.el7.noarch yum-3.4.3-118.el7.noarch yum-rhn-plugin-2.0.1-4.el7.noarch [root@localhost yum.repos.d]# rpm -qa|grep yum|xargs rpm -e --nodeps [root@localhost yum.repos.d]# rpm -qa|grep yum [root@localhost yum.repos.d]#
2.使用國內新的centos的yum包替換redhat自帶的
首先你得先弄清楚自己的系統版本號和系統位數
如果是i386或者i686就是32位的,如果是x86_64就是64位的
# cat /etc/redhat-release
# uname -a
[root@localhost ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.0 (Maipo) [root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux [root@localhost ~]#
然后到
http://mirrors.kernel.org/centos/
或者
http://mirrors.163.com/centos/
找對應系統版本號和系統位數下載,找到yum、yum-plugin-fastestmirror、yum-metadata-parser、python-urlgrabber這四個軟件包下載

上傳都Linux系統中
[root@localhost ~]# ls anaconda-ks.cfg python-urlgrabber-3.10-9.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm python-iniparse-0.4-9.el7.noarch.rpm yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm [root@localhost ~]#
你也可以直接使用wget命令直接下載,命令如下:
# wget https://mirrors.edge.kernel.org/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm
# wget https://mirrors.edge.kernel.org/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
# wget https://mirrors.edge.kernel.org/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
# wget https://mirrors.edge.kernel.org/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
# wget https://mirrors.edge.kernel.org/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
接着就是分別安裝幾個包
# rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
[root@localhost ~]# rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm warning: python-iniparse-0.4-9.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, ke y ID f4a80eb5: NOKEY Preparing... ################################# [100%] package python-iniparse-0.4-9.el7.noarch is already installed file /usr/lib/python2.7/site-packages/iniparse/ini.pyc from install of py thon-iniparse-0.4-9.el7.noarch conflicts with file from package python-iniparse-0 .4-9.el7.noarch file /usr/lib/python2.7/site-packages/iniparse/ini.pyo from install of py thon-iniparse-0.4-9.el7.noarch conflicts with file from package python-iniparse-0 .4-9.el7.noarch
# rpm -ivh python-urlgrabber-3.10-9.el7.noarch.rpm
[root@localhost ~]# rpm -ivh python-urlgrabber-3.10-9.el7.noarch.rpm warning: python-urlgrabber-3.10-9.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] file /usr/lib/python2.7/site-packages/urlgrabber/grabber.py from install of python-urlgrabber-3.10-9.el7.noarch conflicts with file from package python-urlgrabber-3.10-4.el7.noarch file /usr/lib/python2.7/site-packages/urlgrabber/grabber.pyc from install of python-urlgrabber-3.10-9.el7.noarch conflicts with file from package python-urlgrabber-3.10-4.el7.noarch file /usr/lib/python2.7/site-packages/urlgrabber/grabber.pyo from install of python-urlgrabber-3.10-9.el7.noarch conflicts with file from package python-urlgrabber-3.10-4.el7.noarch
# rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost ~]# rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm warning: yum-metadata-parser-1.1.4-10.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:yum-metadata-parser-1.1.4-10.el7 ################################# [100%]
這2個rpm要一起裝!!!
# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
結果報錯了
[root@localhost ~]# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm warning: yum-3.4.3-161.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY error: Failed dependencies: python-urlgrabber >= 3.10-8 is needed by yum-3.4.3-161.el7.centos.noarch rpm >= 0:4.11.3-22 is needed by yum-3.4.3-161.el7.centos.noarch
然后我三個包一起裝
# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm python-urlgrabber-3.10-9.el7.noarch.rpm
出現如下錯誤
[root@localhost ~]# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm python-urlgrabber-3.10-9.el7.noarch.rpm warning: yum-3.4.3-161.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY error: Failed dependencies: rpm >= 0:4.11.3-22 is needed by yum-3.4.3-161.el7.centos.noarch [root@localhost ~]#
解決方法: 將所依賴的python-urlgrabber和rpm包升級
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm
當我執行這條命令的時候報錯了,fuck!!
ping百度域名也能通
[root@localhost ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm --2019-03-27 11:06:35-- http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm Resolving mirrors.163.com (mirrors.163.com)... 59.111.0.251 Connecting to mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2019-03-27 11:06:35 ERROR 404: Not Found. [root@localhost ~]# ping www.baidu.com PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data. 64 bytes from 61.135.169.121: icmp_seq=1 ttl=52 time=3.74 ms 64 bytes from 61.135.169.121: icmp_seq=2 ttl=52 time=3.66 ms ^C --- www.a.shifen.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 3.668/3.705/3.743/0.071 ms [root@localhost ~]#
然后只能自行下載然后上傳到Linux
[root@localhost ~]# ls anaconda-ks.cfg rpm-4.11.3-35.el7.x86_64.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm python-iniparse-0.4-9.el7.noarch.rpm yum-3.4.3-161.el7.centos.noarch.rpm python-urlgrabber-3.10-9.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm [root@localhost ~]#
升級安裝
# rpm -Uvh rpm-4.11.3-35.el7.x86_64.rpm --nodeps
# rpm -Uvh python-urlgrabber-3.10-9.el7.noarch.rpm --nodeps
[root@localhost ~]# rpm -Uvh rpm-4.11.3-35.el7.x86_64.rpm --nodeps warning: rpm-4.11.3-35.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:rpm-4.11.3-35.el7 ################################# [ 50%] Cleaning up / removing... 2:rpm-4.11.1-16.el7 ################################# [100%] [root@localhost ~]# [root@localhost ~]# rpm -Uvh python-urlgrabber-3.10-9.el7.noarch.rpm --nodeps warning: python-urlgrabber-3.10-9.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:python-urlgrabber-3.10-9.el7 ################################# [ 50%] Cleaning up / removing... 2:python-urlgrabber-3.10-4.el7 ################################# [100%] [root@localhost ~]#
再次安裝
# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
[root@localhost ~]# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm warning: yum-3.4.3-161.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:yum-plugin-fastestmirror-1.1.31-5################################# [ 50%] 2:yum-3.4.3-161.el7.centos ################################# [100%] [root@localhost ~]#
查看所有yum包
[root@localhost ~]# rpm -qa | grep yum yum-metadata-parser-1.1.4-10.el7.x86_64 yum-3.4.3-161.el7.centos.noarch yum-plugin-fastestmirror-1.1.31-50.el7.noarch
end
參考博客:
https://blog.csdn.net/indexman/article/details/79570577
https://blog.csdn.net/ytx2014214081/article/details/78468947
redhat7更換yum
https://blog.csdn.net/qq_39136872/article/details/81225752
