yum配置文件的目录在/etc/yum.repos.d/下,以repo结尾的文件,以下是一个yum源配置文件的内容

[BaseOS]
name=CentOS-8
baseurl=file:///mnt/os/
mirrorlist=https://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=BaseOS&infra=$infra
enabled=1
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-Official

[BaseOS] 仓库ID

name 仓库名称

baseurl 使用本地仓库的路径

mirrorlist 使用网络源的路径

enabled 设置是否启用该源,0为不起用,1为启用

gpgcheck 是否检查源

gpgkey 源的密钥

使用yum clean all #清楚源缓存

yum makecache #重建缓存