Centos7.9.2009 重新安装python和yum


Centos 重新安装python和yum

卸载python

 rpm -qa|grep python|xargs rpm -e --allmatches --nodeps
 ​
 whereis python|xargs rm -fr

卸载yum

 rpm -qa|grep yum|xargs rpm -e --allmatches --nodeps
 ​
 rm -rf /etc/yum.repos.d/*
 ​
 whereis yum|xargs rm -fr

安装python

 mkdir /usr/local/src/python
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-2.7.5-89.el7.x86_64.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python2-rpm-macros-3-34.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-rpm-macros-3-34.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-devel-2.7.5-89.el7.x86_64.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-libs-2.7.5-89.el7.x86_64.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-srpm-macros-3-34.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-ipaddress-1.0.16-2.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-six-1.9.0-2.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-urllib3-1.10.2-7.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/rpm-python-4.11.3-45.el7.x86_64.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-chardet-2.2.1-3.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
 ​
  #安装​​
 rpm -ivh python2-*
 rpm -ivh python-*   #rpm-python-* 
 rpm -ivh rpm-python-*   #rpm-python-* 
 ​
 如果中间过程出现了类似下面的代码,这是包与包之间的依赖关系,只需要卸载已经安装的包(rpm -e 包名(没有.rpm后缀)),然后先安装依赖包
 如:
 

rpm -e yum-metadata-parser-1.1.2-16.el6.x86_64
rpm -ivh /yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

安装libxml2

 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/libxml2-2.9.1-6.el7.5.x86_64.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/libxml2-python-2.9.1-6.el7.5.x86_64.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/lvm2-python-libs-2.02.187-6.el7.x86_64.rpm
 ​
 #安装​
 rpm -ivh libxml2-*
 rpm -ivh lvm2-*

安装yum

 mkdir /usr/local/src/yum
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-plugin-aliases-1.1.31-54.el7_8.noarch.rpm
 wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
 
 #安装​​
 rpm -ivh yum-*

完成

yum

发表评论

Connect with