yum源分为本地源和网络源。但是都是在/etc/yum.repos.d中进行编辑。在这里我是用阿里云的。
[root@Wang ~]# cd /etc/yum.repos.d/ #进入指向文件
[root@Wang yum.repos.d]# vim wl.repo #创建并且编辑一个yum文件,在这里一定要以.repo结尾
将一下内容编写进入wl.repo ,再保存退出。
[BaseOS]
name=BaseOS
baseurl=https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/
gpgcheck=0
enabled=1
[AppStream]
name=AppStream
baseurl=https://mirrors.aliyun.com/centos/8/AppStream/x86_64/os/
gpgcheck=0
enabled=1
[root@Wang yum.repos.d]# yum clean all #清除源数据
[root@Wang yum.repos.d]# yum makecache #加载元数据
[root@Wang yum.repos.d]# yum repolist #列出可用仓库
Failed to set locale, defaulting to C.UTF-8
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.
repo id repo name
AppStream AppStream
BaseOS BaseOS