linux 下重新安裝yum
1.刪除原有的yum
rpm -aq|grep yum|xargs rpm -e --nodeps
2.下載yum安裝檔案
**訪問http://mirrors.163.com根據系統版本查詢rpm包
(檢視系統版本指令碼lsb_release -a)
本文用的centos7所以去http://mirrors.163.com/centos/7/os/x86_64/Packages/ 下找
(其它系統版本不一樣會安裝失敗,所以一定要自己比對)
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
3.安裝
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
4.更新repo檔案
進入 /etc/yum.repos.d資料夾下,
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
刪除原來的配置檔案 rm -rf CentOS-Base.repo
修改新配置檔名 mv CentOS7-Base-163.repo CentOS7-Base.repo