卸载rhel的默认安装的yum包
查看yum包
rpm -qa | grep yum
卸载
rpm -qa | grep yum | xargs rpm -e –nodeps
下载新的yum包
打开网页 http://mirrors.ustc.edu.cn/centos/7.3.1611/os/x86_64/Packages/
找到下列rpm包,下载并安装
yum-3.2.22-26.el5.centos.noarch.rpm
yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
并且安装之
rpm -ivh yum-*
下载yum的配置源
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
下载到 /etc/yum.repos.d/ 目录下面
运行yum makecache生成缓存
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
addons | 1.9 kB 00:00
addons/filelists_db | 564 B 00:00
addons/other_db | 552 B 00:00
addons/primary_db | 1.1 kB 00:00
base | 1.1 kB 00:00
base/filelists | 3.0 MB 00:01
这样就成功了。