https://vault.centos.org/

卸载yum,重装yum

 

系统版本:

[root@CenOS8 rpm]# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core) 

 

1、卸载yum

1

2

3

rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps

rm -rf /etc/yum.repos.d/*

whereis yum|xargs rm -frv

2、验证是否删除干净:

1

whereis yum

3、下载两个对应系统版本下的rpm:yum-4.2.17-7.el8_2.noarch.rpm 、centos-repos-8.2-2.2004.0.2.el8.x86_64.rpm ,

     下载地址:https://vault.centos.org/ ,下不下来就本地rz上传:

wget  https://vault.centos.org/8.2.2004/BaseOS/x86_64/os/Packages/yum-4.2.17-7.el8_2.noarch.rpm

wget  https://vault.centos.org/8.2.2004/BaseOS/x86_64/os/Packages/centos-repos-8.2-2.2004.0.2.el8.x86_64.rpm

4、安装:

rpm -ivh  yum-4.2.17-7.el8_2.noarch.rpm 

rpm -ivh  centos-repos-8.2-2.2004.0.2.el8.x86_64.rpm

5、检查是否可以了:

yum repolist

yum update

 

上边亲测:

===========================================================================================

下边CV:

 

Linux 系统为 CentOS Linux release 7.4.1708

重装yum和python

 

  1. 首先卸载现有python
    1. rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps #卸载python

    2. whereis python |xargs rm -frv ##删除所有残余文件

    3. whereis python ##验证删除,返回无结果

     

  2.  删除现有的yum
    1. rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps #删除yum

    2. whereis yum |xargs rm -frv #删除残留文件

    3.  

      whereis yum #验证删除完成

  3. 找到下载文件源
    首先在这里找到服务器对应的版本,如 7.4.1708 进入这里目录 找到对应版本的rpm,替换下面的文件。

  4. 下载并安装,注意顺序,先安装python 然后 yum。不然安装后还会报错,重新来一遍。

    1. # python安装

    2. rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-2.7.5-58.el7.x86_64.rpm

    3. rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-devel-2.7.5-58.el7.x86_64.rpm

    4. rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm

    5. rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-libs-2.7.5-58.el7.x86_64.rpm

    6. rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm

    7. rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm

    8. rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/rpm-python-4.11.3-25.el7.x86_64.rpm

    9.  

    10. # yum安装

    11. rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm

    12. rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

    13. rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm

  5. 验证 

    1. #验证python

    2. python

    3. #验证yum

    4. yum

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐