
一.搭建本地源1.挂载镜像文件临时挂载[rootA ~]# mount /dev/sr0 /mnt mount: /mnt: WARNING: source write-protected, mounted read-only.永久挂载# 修改系统开机会自动运行的脚本# 最后一行添加 mount 挂载命令# 给文件添加可执行权限[rootA ~]# vim /etc/rc.d/rc.local #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run chmod x /etc/rc.d/rc.local to ensure # that this script will be executed during boot. touch /var/lock/subsys/local mount /dev/sr0 /mnt ~ ~ [rootA ~]# chmod x /etc/rc.d/rc.local2.建立本地yum源配置文件[rootA ~]# vim /etc/yum.repos.d/rhel10.repo [BaseOS] nameBaseOS baseurlfile:///mnt/BaseOS gpgcheck0 [AppStream] nameAppStream baseurlfile:///mnt/AppStream gpgcheck0写入内容[BaseOS]nameBaseOSbaseurlfile:///mnt/BaseOSgpgcheck0[AppStream]nameAppStreambaseurlfile:///mnt/AppStreamgpgcheck0[BaseOS]nameBaseOSbaseurlfile:///mnt/BaseOSgpgcheck0[AppStream]nameAppStreambaseurlfile:///mnt/AppStreamgpgcheck0[BaseOS]nameBaseOSbaseurlfile:///mnt/BaseOSgpgcheck0[AppStream]nameAppStreambaseurlfile:///mnt/AppStreamgpgcheck0# 清空缓存[rootA ~]# yum clean all 正在更新 Subscription Management 软件仓库。 无法读取客户身份 本系统尚未在权利服务器中注册。可使用 rhc 或 subscription-manager 进行注册。 0 个文件已删除# 生成新的 yum 缓存[rootA ~]# yum makecache 正在更新 Subscription Management 软件仓库。 无法读取客户身份 本系统尚未在权利服务器中注册。可使用 rhc 或 subscription-manager 进行注册。 BaseOS 75 MB/s | 1.5 MB 00:00 AppStream 158 MB/s | 1.5 MB 00:00 元数据缓存已建立。二.网络源#找到公开网络源#在 /etc/yum.repos.d 目录下创建 .repo 结尾的配置文件#重建缓存生效[rootA ~]# vim /etc/yum.repos.d/ali.repo [ali-BaseOS] nameali-BaseOS baseurlhttps://mirrors.aliyun.com/rockylinux/10/BaseOS/x86_64/os/ gpgcheck0 [ali-AppStream] nameali-AppStream baseurlhttps://mirrors.aliyun.com/rockylinux/10/AppStream/x86_64/os/ gpgcheck0 ~ ~ ~ [rootA ~]# yum clean all [rootA ~]# yum makecache三.EPEL拓展源[rootA ~]# vim /etc/yum.repos.d/epel.repo [epel] nameepel baseurlhttps://mirrors.aliyun.com/epel/10/Everything/x86_64/ gpgcheck0 ~ ~ ~ ~ [rootA ~]# yum clean all [rootA ~]# yum makecache