1、查看系统内核
cat /etc/redhat-release?
?
2、彻底卸载python2
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps #强制删除已安装程序及其关联
whereis python |xargs rm -frv #删除所有残余文件 ##xargs,允许你对输出执行其他某些命令?
3、卸载yum
由于yum会依赖python2,python2误删,导致yum不可用,不可用了就先删掉,以防依赖出错
#删除yum
rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps
#删除残留文件
whereis yum |xargs rm -frv
#验证删除完成,返回无结果
whereis yum
4、创建目录python和yum用以存放rpm包
#mkdir /usr/local/python
#mkdir /usr/local/yum
?5、在官方网站下载对应的包
官方网站 http://vault.centos.org?
注意:由于没有找到内核版本为7.6.1810的包,所以就下个版本稍微低点的
1)下载python的rpm包:
#cd /usr/local/python
#wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/python-2.7.5-48.el7.x86_64.rpm
#wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
#wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
#wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/python-devel-2.7.5-48.el7.x86_64.rpm
#wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/python-libs-2.7.5-48.el7.x86_64.rpm
#wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
#wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/rpm-python-4.11.3-21.el7.x86_64.rpm
(2)下载yum的rpm包:
#cd /usr/local/yum
#wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm
#wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
#wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
6、安装python以及yum的rpm包?
(1)安装python:
#cd /usr/local/python
#rpm -ivh python-* rpm-python-* --nodeps --force
(2)安装yum:
#cd /usr/local/yum
#rpm -ivh yum-*
?
?
|