1. 创建局域网的基于Base的私有yum源
1.1. 说明
| centos的base包可以从系统镜像中获取或者第三方平台获取 |
1.2. repo仓库配置文件
| [repositoryID] |
| name=Some name for this repository |
| baseurl=url://path/to/repository/ |
| enabled={1|0} |
| gpgcheck={1|0} |
| gpgkey=URL |
| enablegroups={1|0} |
| failovermethod={roundrobin|priority} |
| roundrobin:意为随机挑选,默认值 |
| priority:按顺序访问 |
| cost= 默认为1000 |
1.3. 前期准备
1.4. 操作步骤:
1.4.1. yum服务器4种baseurl形式
| file:///var/www/html/CD_Centos8.5 |
| http:// |
| https:// |
| ftp:// |
1.4.2. 方法1file形式访问
| [01:19:00 root@localhost ~] |
| [01:28:19 root@localhost ~] |
| mount: /var/www/html/CD_Centos8.5: WARNING: device write-protected, mounted read-only. |
| |
| [01:59:19 root@localhost yum.repos.d] |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| [base] |
| name=Centos8 |
| baseurl=file:///var/www/html/CD_Centos8.5/BaseOS |
| file:///var/www/html/CD_Centos8.5/AppStream |
| |
| gpgcheck=0 |
| |
| [01:59:26 root@localhost yum.repos.d] |
| 0 文件已删除 |
| [01:59:48 root@localhost yum.repos.d] |
| 仓库 id 仓库名称 |
| base Centos8 |
| [01:59:55 root@localhost yum.repos.d] |
| Centos8 50 MB/s | 2.6 MB 00:00 |
| 上次元数据过期检查:0:00:01 前,执行于 2022年08月14日 星期日 02时00分03秒。 |
| 软件包 mysql-community-client-5.7.37-1.el7.x86_64 已安装。 |
| 依赖关系解决。 |
| 无需任何处理。 |
| 完毕! |
1.4.3. http网页形式访问
-
安装apache服务器
| [02:12:50 root@localhost yum.repos.d]#yum install httpd -y |
-
挂载光盘镜像
| [02:19:00 root@localhost ~] |
| [02:28:19 root@localhost ~] |
| mount: /var/www/html/CD_Centos8.5: WARNING: device write-protected, mounted read-only. |
-
访问浏览器地址:
| http://192.168.100.30/CD_Centos8.5/BaseOS/ |
| http://192.168.100.30/CD_Centos8.5/AppStream/ |


-
配置repo源文件
| [02:20:46 root@localhost yum.repos.d] |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| [base] |
| name=Centos8 |
| baseurl=http://192.168.100.30/CD_Centos8.5/BaseOS/ |
| http://192.168.100.30/CD_Centos8.5/AppStream/ |
| |
| gpgcheck=0 |
| [02:20:49 root@localhost yum.repos.d] |
| 6 文件已删除 |
| [02:20:59 root@localhost yum.repos.d] |
| 仓库 id 仓库名称 |
| base Centos8 |
| [02:21:06 root@localhost yum.repos.d] |
| Centos8 125 MB/s | 2.6 MB 00:00 |
| 软件包 mysql-community-client-5.7.37-1.el7.x86_64 已安装。 |
| 依赖关系解决。 |
| 无需任何处理。 |
| 完毕! |
| |
| [02:44:02 root@localhost yum.repos.d] |
| [02:44:19 root@localhost yum.repos.d] |
2.2. 配置阿里云yum源文件
| [02:24:39 root@localhost yum.repos.d] |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| [base] |
| name=CentOS-8.5.2111 - Base - mirrors.aliyun.com |
| baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/BaseOS/$basearch/os/ |
| http://mirrors.aliyuncs.com/centos-vault/8.5.2111/BaseOS/$basearch/os/ |
| http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/BaseOS/$basearch/os/ |
| gpgcheck=0 |
| gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official |
| |
| |
| [extras] |
| name=CentOS-8.5.2111 - Extras - mirrors.aliyun.com |
| baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/extras/$basearch/os/ |
| http://mirrors.aliyuncs.com/centos-vault/8.5.2111/extras/$basearch/os/ |
| http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/extras/$basearch/os/ |
| gpgcheck=0 |
| gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official |
| |
| [02:24:53 root@localhost yum.repos.d] |
| 仓库 id 仓库名称 |
| AppStream CentOS-8.5.2111 - AppStream - mirrors.aliyun.com |
| base CentOS-8.5.2111 - Base - mirrors.aliyun.com |
| extras CentOS-8.5.2111 - Extras - mirrors.aliyun.com |
| |
2.3. 安装apache服务器
| [02:40:50 root@localhost yum.repos.d]#yum install httpd -y |
2.4. 访问浏览器地址查看
| http://192.168.100.30/centos/extras/ |

2.5. 配置repo源文件,并测试
| [02:47:44 root@localhost yum.repos.d] |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| [extras] |
| name=CentOS-8.5.2111 - Extras - mirrors.aliyun.com |
| baseurl=http://192.168.100.30/centos/extras/ |
| gpgcheck=0 |
| [base] |
| name=Centos8 |
| baseurl=http://192.168.100.30/CD_Centos8.5/BaseOS/ |
| http://192.168.100.30/CD_Centos8.5/AppStream/ |
| gpgcheck=0 |
| [02:47:47 root@localhost yum.repos.d] |
| 11 文件已删除 |
| [02:47:56 root@localhost yum.repos.d] |
| 仓库 id 仓库名称 |
| base Centos8 |
| extras CentOS-8.5.2111 - Extras - mirrors.aliyun.com |
| [02:49:00 root@localhost yum.repos.d] |
| CentOS-8.5.2111 - Extras - mirrors.aliyun.com 1.3 MB/s | 10 kB 00:00 |
| |
本文作者:zxl1024320609
本文链接:https://www.cnblogs.com/zxl1024320609/p/16586908.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步