RHEL9.4 配置本地源和 EPEL 源
一、本地源
1.1 创建 repo 配置文件
vi /etc/yum.repos.d/local.repo
[BaseOS]
name=Red Hat Enterprise Linux 9.4.0 (BaseOS)
baseurl=file:///opt/repo/BaseOS
enabled=1
gpgcheck=1
gpgkey=file:///opt/repo/RPM-GPG-KEY-redhat-release
[AppStream]
name=Red Hat Enterprise Linux 9.4.0 (AppStream)
baseurl=file:///opt/repo/AppStream
enabled=1
gpgcheck=1
gpgkey=file:///opt/repo/RPM-GPG-KEY-redhat-release
1.2 复制系统镜像软件文件
mkdir /mnt/repo
mount /dev/cdrom /mnt/repo
mkdir /opt/repo
cp -r /mnt/repo/* /opt/repo
1.3 关闭 RHEL 订阅提醒
sed -i 's/enabled=1/enabled=0/g' /etc/yum/pluginconf.d/subscription-manager.conf
二、EPEL 源
2.1 安装 epel-release
dnf install -y https://mirrors.tuna.tsinghua.edu.cn/epel/epel-release-latest-9.noarch.rpm
2.2 更换国内源
推荐两个常用的国内源,这里我使用的是清华源
sed -e 's!^metalink=!#metalink=!g' \
-e 's!^#baseurl=!baseurl=!g' \
-e 's!https\?://download\.fedoraproject\.org/pub/epel!https://mirrors.bfsu.edu.cn/epel!g' \
-e 's!https\?://download\.example/pub/epel!https://mirrors.bfsu.edu.cn/epel!g' \
-i /etc/yum.repos.d/epel{,-testing}.repo
三、更新仓库
dnf update