【Red Hat】 Red Hat 系统提示未注册订阅管理,并进行阿里yum源更新的解决方案

avatar
作者
筋斗云
阅读量:8

目录

🌊1. 问题说明

🌊2. 解决方案

🌍2.1 Redhat 官网注册与订阅

🌍2.2 Redhat 登录已订阅账号

🌍2.3 更换 Redhat 为阿里yum源

🌍2.4 验证


🌊1. 问题说明

使用 yum makecacheyum update 命令时 Redhat 系统显示没有订阅,问题内容如下:

[root@shuym ~]# yum update
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>


[root@shuym ~]# yum makecache
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>


🌊2. 解决方案

前往Redhat 官网注册,然后订阅【订阅前提是需要有一个 Redhat 注册的账号】

🌍2.1 Redhat 官网注册与订阅

【Redhat 官网注册】

传送门:Redhat 官网

使用英文填写好信息后注册,然后登录。


【Redhat 官网订阅】

传送门:Redhat 开发者平台(订阅功能便来自于开发者平台)

使用之前注册的账号在开发者平台完成登录。

登录后前往:订阅网址

显示如下表示订阅成功:


🌍2.2 Redhat 登录已订阅账号

回到虚拟机,登录已经订阅的账号+密码。

subscription-manager register

显示如图说明配置成功!


🌍2.3 更换 Redhat 为阿里yum源

由于使用的yum源下载速度很慢,所以这里将yum源更新成阿里的yum源。

先删除原来的yum源:

rm -r /etc/yum.repos.d/*

下载新的阿里yum源:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

此时进入 /etc/yum.repos.d/ 目录会多出来 CentOS-Base.repo 文件。

清理缓存:

yum clean all

编辑  CentOS-Base.repo 文件,把文件里面的 $releasever 全部替换为版本号:最后保存!

注意:这里的7是因为我的Redhat 版本是7.6,所以选择版本号7,如果版本是6.x则修改成6即可。

cd /etc/yum.repos.d/ && vi CentOS-Base.repo

按下esc输入:(如果是版本是6.x则将7修改成6即可

%s/$releasever/7/g 

然后保存退出。


🌍2.4 验证

更新yum的本地数据库,用root执行:

yum makecache yum update

问题解决!

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!