CentOS 7安裝yum

導語

自己誤將yum卸載,在重裝的時候一直報錯:

error: Failed dependencies:
    /usr/bin/python is needed by yum-3.4.3-163.el7.centos.noarch
    python >= 2.4 is needed by yum-3.4.3-163.el7.centos.noarch
    python(abi) = 2.7 is needed by yum-3.4.3-163.el7.centos.noarch
    python-iniparse is needed by yum-3.4.3-163.el7.centos.noarch
    python-sqlite is needed by yum-3.4.3-163.el7.centos.noarch
    python-urlgrabber >= 3.10-8 is needed by yum-3.4.3-163.el7.centos.noarch
    rpm-python is needed by yum-3.4.3-163.el7.centos.noarch
    libpython2.7.so.1.0()(64bit) is needed by yum-metadata-parser-1.1.4-10.el7.x86_64
    python(abi) = 2.7 is needed by yum-metadata-parser-1.1.4-10.el7.x86_64

找了網上的很多方法,下面是自己總結的一套親測有效的方法:

1,查看yum安裝包

# rpm -qa | grep yum
yum-plugin-fastestmirror-1.1.31-52.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-utils-1.1.31-52.el7.noarch   

2,將上面的安裝包全部卸載

#rpm -e yum-plugin-fastestmirror-1.1.31-52.el7.noarch --nodeps
#rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
#rpm -e yum-utils-1.1.31-52.el7.noarch --nodeps

3,下載yum安裝包

網址 :http://mirrors.163.com/centos/7/os/x86_64/Packages/

libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm     

python-ipaddress-1.0.16-2.el7.noarch.rpm  

lvm2-python-libs-2.02.185-2.el7.x86_64.rpm

python-kitchen-1.1.1-5.el7.noarch.rpm    

yum-3.4.3-163.el7.centos.noarch.rpm

python-2.7.5-86.el7.x86_64.rpm       

python-libs-2.7.5-86.el7.x86_64.rpm    

yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm  

python-pycurl-7.19.0-19.el7.x86_64.rpm    

yum-plugin-aliases-1.1.31-52.el7.noarch.rpm

python-chardet-2.2.1-3.el7.noarch.rpm       

python-setuptools-0.9.8-7.el7.noarch.rpm  

yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

python-devel-2.7.5-86.el7.x86_64.rpm                          

python-urlgrabber-3.10-9.el7.noarch.rpm   

yum-plugin-protectbase-1.1.31-52.el7.noarch.rpm

python-iniparse-0.4-9.el7.noarch.rpm                          

rpm-python-4.11.3-40.el7.x86_64.rpm       

yum-utils-1.1.31-52.el7.noarch.rpm

4,下載完成後執行

#rpm -Uvh --replacepkgs lvm2-python-libs*.rpm --nodeps --force
#rpm -Uvh --replacepkgs libxml2-python*.rpm --nodeps --force
#rpm -Uvh --replacepkgs python*.rpm --nodeps --force
#rpm -Uvh --replacepkgs rpm-python*.rpm yum*.rpm --nodeps --force

在這裏插入圖片描述

5,安裝成功

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章