redhat7 配置使用centos的yum源
使用yum update 更新系统。提示:
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
无法更新。redhat使用自带的yum源是需要注册的。

1、检查是否安装yum包
rpm -qa |grep yum

2、删除redhat自带的yum包
rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)
rpm -qa|grep python-urlgrabber|xargs rpm -e --nodeps

3、下载使用Centos7的yum包
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-42.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
下载完成后安装yum软件包
注意:单个的安装包可能会依赖其它包(例如yum和yum-fastestmirror会相互依赖),所以我们可以把所有这些包放在一起,用一行命令将它们同时安装即可
rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm
rpm -ivh yum-*

由于安装时出现了异常,所以不清楚怎么解决,所以下载较低版本后再重新安装
链接:http://rpm.pbone.net/
不报错版本安装包:
yum-3.4.3-132.el7.centos.0.1.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
yum-updateonboot-1.1.31-34.el7.noarch.rpm
yum-utils-1.1.31-34.el7.noarch.rpm
最后显示安装成功

4、更换使用阿里云yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
下载后将$releasever全部替换为版本号7
5、清除并生成缓存
yum clean all
yum makecache
yum update