前言
跟着刘遄老师的《Linux就该这么学》的第二版进行Linux的学习,用虚拟机搭建了一个Linux学习环境。我还想在上面搭建gcc、MySQL等环境。但我使用yum install
命令进行软件安装时,会出现如下提示,提示我们需要注册。
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Error: There are no enabled repos.
为了避免注册、付费等对我学习带来的不便,我使用阿里云镜像的CentOS的yum源来进行替换。
替换yum源
- 进入系统的yum配置目录
cd /etc/yum.repos.d/
- 对目录中存在的文件名进行修改(作用:一是不让这个文件生效,二是对其备份)
mv redhat.repo redhat.repo_bak
- 下载阿里云yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
此时,我们已经可以使用yum命令来安装软件了,但是还是会出现注册提示,下面我们来消除提示。
消除注册提示
方法一:禁用Subscription Management提示
- 修改两个文件,使其中的
Enable=0
vim /etc/yum/pluginconf.d/product-id.conf
vim /etc/yum/pluginconf.d/subscription-manager.conf
- 修改完后,执行如下命令
yum clean all
yum makecache
OK,完成,再也没有烦人的提示了!
方法二:卸载Subscription Management
这个方法很简单,直接输入命令进行卸载就行了。
yum remove subscription-manager