- 查看redhat原有的yum包有哪些:
[root@localhost ~]# rpm -qa|grep yum
yum-utils-1.1.31-24.el7.noarch
yum-langpacks-0.4.2-3.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-rhn-plugin-2.0.1-4.el7.noarch
PackageKit-yum-0.8.9-11.el7.x86_64
yum-3.4.3-118.el7.noarch
- 尝试使用xargs来删除这些包
[root@localhost ~]# rpm -qa|grep yum|xargs rmp -e --nodeps
xargs: rmp: 没有那个文件或目录
- 没有xargs 一个一个删除
[root@localhost ~]# rpm -qa|grep xargs
[root@localhost ~]# rpm -e --nodeps yum-utils-1.1.31-24.el7.noarch
[root@localhost ~]# rpm -e --nodeps yum-langpacks-0.4.2-3.el7.noarch
[root@localhost ~]# rpm -e --nodeps yum-metadata-parser-1.1.4-10.el7.x86_64
[root@localhost ~]# rpm -e --nodeps yum-rhn-plugin-2.0.1-4.el7.noarch
[root@localhost ~]# rpm -e --nodeps PackageKit-yum-0.8.9-11.el7.x86_64
[root@localhost ~]# rpm -e --nodeps rpm -e --nodeps yum-3.4.3-118.el7.noarch
[root@localhost ~]# rpm -qa|grep yum
- 查看当前操作系统版本
[root@localhost ~]# cd /etc
[root@localhost etc]# cat redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
- 下载centos的yum
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
- 安装centos的yum 安装过程中发现依赖了python-urlgrabber 又下载并安装了它安装python-urlgrabber 必须先删除老的版本
[root@localhost ~]# rpm -e --nodeps python-urlgrabber-3.10-4.el7.noarch
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
[root@localhost ~]#rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm
[root@localhost ~]#rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
- 最后两个相互依赖 所以要放在一起执行
[root@localhost ~]#rpm -ivh yum-3.4.3-150.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
- 更换yum源
[root@localhost ~]#cd /etc/yum.repos.d/
[root@localhost ~]#wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
注意:此处需要将CentOS7-Base-163.repo中的$releasever全部换成7
- 重建缓存
[root@localhost ~]#yum clean all
[root@localhost ~]#yum makecache
按照网上的步骤的花,最后一步还有一个“yum update”,会把所有的rpm都更新到最新状态,我暂时觉得没有必要没有执行。
最终测试yum install成功。