20201118新更:
发下一个安装yum巨坑的问题在安装yum时,
[root@bigdata111 yum]# rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm
error: Failed dependencies:
rpm-python is needed by yum-3.4.3-158.el7.centos.noarch
yum-plugin-fastestmirror is needed by yum-3.4.3-158.el7.centos.noarch
这里的意思是,如果安装yum 3.3.4 是需要安装 rpm-python 和 yum-plugin-fastestmirror 这两个依赖的.
[注] : 在选择两个版本时,我用的都是相关的低版本.我的Centos7.5 1804
如下这个是可以[单独]安装的
[root@bigdata111 yum]# rpm -ivh rpm-python-4.11.3-32.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:rpm-python-4.11.3-32.el7 ################################# [100%]
[root@bigdata111 yum]# rpm -ivh yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
error: Failed dependencies:
yum >= 3.0 is needed by yum-plugin-fastestmirror-1.1.31-45.el7.noarch
这条的意思就是安装 yum-plugin 是需要 yum >= 3.0 yum3.0以上的版本的安装
[root@bigdata111 yum]# rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm
error: Failed dependencies:
yum-plugin-fastestmirror is needed by yum-3.4.3-158.el7.centos.noarch
这条的意思是安装yum3.4这个rpm需要yum-plugin-fastestmirror的.这基本上就是个鸡生蛋,蛋生鸡的问题了.无解!
后来我发现需要两个一起安装才可以!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[root@bigdata111 yum]# rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:yum-plugin-fastestmirror-1.1.31-4################################# [ 50%]
2:yum-3.4.3-158.el7.centos ################################# [100%]
这就可以了! 单个装不行,一起装才可以..巨坑,好了.我再去重装python2.7去试试了
1.卸载现有的Python,强制删除已安装程序及其关联:
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps
2.强制删除Python所有残余文件:
whereis python| xargs rm -frv
3.卸载现有的yum:
rpm -qa| grep yum| xarg
4.强制删除所有残余文件:
whereis yum| xargs rm -frv
5. 检查CentOS 7内核版本:cat /etc/centos-release。
6.寻找对应的文件下载,在http://vault.centos.org找到对应的依赖下载。
注:原清华镜像源下https://mirrors.tuna.tsinghua.edu.cn/centos/7.5.1804/ 这个地址换啦,只有一个readme文件了,所以更改路径为下列地址:
我的CentOS7版本完整路径:https://vault.centos.org/7.5.1804/os/x86_64/Packages/
在Centos命令行中直接执行以下命令
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-2.7.5-68.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-chardet-2.2.1-1.el7_1.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-devel-2.7.5-68.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-ipaddress-1.0.16-2.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-libs-2.7.5-68.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-virtualenv-15.1.0-2.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-build-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-build-libs-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-libs-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-python-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-sign-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-aliases-1.1.31-45.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-protectbase-1.1.31-45.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm
7.批量安装方式:
rpm -Uvh --replacepkgs python*.rpm
rpm -Uvh --replacepkgs rpm-python*.rpm yum*.rpm rpm-*.rpm
下载完成后安装这些包,有些依赖你可能要自己解决:
rpm -Uvh --replacepkgs *.rpm
注意,无论是单个安装还是批量安装,若是出现安装依赖的问题,针对报错的依赖复制下来,在http://vault.centos.org/7.7.11988/os/x86_64/Packages/(结合自己实际的CentOS7版本地址)上进行搜索依赖包,下载到CentOS 7机子上,安装报错的依赖包。
8.完成测试
输入命令yum和python -V