Centos7 配置本地yum源为iso镜像

创建挂载路径

sudo mkdir /mnt/iso

挂载ISO镜像到目录

sudo mount -o loop CentOS-7-x86_64-Minimal-1810.iso /mnt/iso

下载地址:
http://mirrors.sohu.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso

验证挂载

df -h

创建本地yum源配置文件

sudo touch /etc/yum.repos.d/local.repo

编辑local.repo文件内容

[local_server]
name=Thisis a local repo
baseurl=file:///mnt/iso
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

更新yum源

yum clean all 
yum makecache

你可能感兴趣的:(Centos7 配置本地yum源为iso镜像)