重灌yum和python

夏--發表於2020-12-20

https://vault.centos.org/

 

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

相關文章