网络yum源配置文件:
[14:42:19 root@centos8 cd]#cat /etc/yum.repos.d/base.repo
[BaseOS]
name=BaseOS
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
https://mirrors.huaweicloud.com/centos/$releasever/BaseOS/$basearch/os/
https://mirrors.cloud.tencent.com/centos/$releasever/BaseOS/$basearch/os/
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/BaseOS/$basearch/os/
http://mirrors.163.com//centos/$releasever/BaseOS/$basearch/os/
http://mirrors.sohu.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[AppStream]
name=AppStream
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
https://mirrors.huaweicloud.com/centos/$releasever/AppStream/$basearch/os/
https://mirrors.cloud.tencent.com/centos/$releasever/AppStream/$basearch/os/
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/AppStream/$basearch/os/
http://mirrors.163.com/centos/$releasever/AppStream/$basearch/os/
http://mirrors.sohu.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[EPEL]
name=EPEL
baseurl=https://mirrors.aliyun.com/epel/$releasever/Everything/$basearch/
https://mirrors.huaweicloud.com/epel/$releasever/Everything/$basearch/
https://mirrors.cloud.tencent.com/epel/$releasever/Everything/$basearch/
https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/Everything/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-$releasever
[extras]
name=extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
https://mirrors.huaweicloud.com/centos/$releasever/extras/$basearch/os/
https://mirrors.cloud.tencent.com/centos/$releasever/extras/$basearch/os/
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/os/
http://mirrors.163.com/centos/$releasever/extras/$basearch/os/
http://mirrors.sohu.com/centos/$releasever/extras/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
enabled=1
[centosplus]
name=centosplus
baseurl=https://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/os/
https://mirrors.huaweicloud.com/centos/$releasever/centosplus/$basearch/os/
https://mirrors.cloud.tencent.com/centos/$releasever/centosplus/$basearch/os/
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/os/
http://mirrors.163.com/centos/$releasever/centosplus/$basearch/os/
http://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
本地yum源:
标签:centos,自建,mirrors,仓库,com,basearch,releasever,yum,os From: https://www.cnblogs.com/tanll/p/17746134.html
1. 首先插入光盘镜像
2. 可以手动挂载或者使用yum install -y autofs来自动挂载光盘
3. 编写配置文件,放在/etc/yum.repos.d目录下,以.repo后缀结尾即可
以安装autofs自动挂载为例。
[14:54:38 root@centos8 ~]#yum install -y autofs
[14:55:38 root@centos8 ~]#systemctl enabled --now autofs
[14:56:19 root@centos8 ~]#ls /misc/cd/AppStream/
Packages repodata
[14:57:03 root@centos8 ~]#cat /etc/yum.repos.d/CentOS-Linux-AppStream.repo
[cd.app]
name=cd.app
baseurl=file:///misc/cd/AppStream
#autofs自动挂载镜像到/misc/cd目录,指向/misc/cd/AppStream,可以看到repodata目录
gpgcheck=0
enabled=1
[14:59:45 root@centos8 ~]##cat /etc/yum.repos.d/CentOS-Linux-BaseOS.repo
[cd.baseos]
name=cd.baseos
baseurl=file:///misc/cd/BaseOS
gpgcheck=0
enable=1