使用 yum makecache 或 yum 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>
前往Redhat 官网注册,然后订阅【订阅前提是需要有一个 Redhat 注册的账号】
【Redhat 官网注册】
传送门:Redhat 官网
使用英文填写好信息后注册,然后登录。
【Redhat 官网订阅】
传送门:Redhat 开发者平台(订阅功能便来自于开发者平台)
使用之前注册的账号在开发者平台完成登录。
登录后前往:订阅网址
显示如下表示订阅成功:
回到虚拟机,登录已经订阅的账号+密码。
subscription-manager register
显示如图说明配置成功!
由于使用的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 最后保存!
注意:这里的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
然后保存退出。
更新yum的本地数据库,用root执行:
yum makecache
yum update
问题解决!
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有