Back

本地yum源配置

Linux本地yum源配置,以Oracle Linux 8.6为例

创建系统镜像上传目录

mkdir /soft/os_iso

想个办法传上镜像文件

备份默认资源库

cd /etc/yum.repos.d
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/

配置yum源

在/etc/yum.repos.d/下创建一个local.repo文件

vi /etc/yum.repos.d/local.repo

[OL8_BaseOS]  
name=Oracle Linux 8 x86_64 BaseOS
baseurl=file:///mnt/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
gpgcheck=0
enabled=1

[OL8_AppStream]     
name=Oracle Linux 8 x86_64 AppStream
baseurl=file:///mnt/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
gpgcheck=0
enabled=1

挂载iso镜像

cd /soft/os_iso

mount -o loop OracleLinux-R8-U6-x86_64-dvd-8.6.iso /mnt

更新元数据缓存

# 清除缓存,如果是第一次配置可以不输入
yum clean all 

dnf repolist
dnf makecache

检测和查看

#检查是否成功
dnf list

#查看当前yum源
yum repolist all
Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme Stack designed by Jimmy
© Licensed Under CC BY-NC-SA 4.0