1.删除自带的yum: rpm -aq | grep yum | xargs rpm -e --nodeps
2.下载CentOS的yum安装文件:
wget http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm
wget http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
3.安装yum:
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-132.el7.centos.0.1.noarch.rpm
rpm -ivh yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
4.更新repo文件:从http://mirrors.163.com/.help/centos.html下载对应版本的repo文件,将$releasever替换为对应版本号,并将gpgkey后面的值替换为http://mirrors.163.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7
5.清除所有缓存:yum clean all
6.测试:yum update
7.安装epel源:yum install epel-release