自建yum仓库,分别为网络源和本地源

网络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源:


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
posted @   小糊涂90  阅读(36)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具
点击右上角即可分享
微信分享提示