Linux挂载iso镜像文件作为本地yum源

1 将ISO文件上传至 /mnt 目录下,创建/mnt/cdrom文件夹,挂载ISO文件到/mnt/cdrom下:
[root@localhost]# mount -o  loop /mnt/CentOS-7-x86_64-DVD-1708.iso   /mnt/cdrom
2 创建repo文件:
[root@localhost /]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv *.repo /etc/yum.repos.d/bak
[root@localhost yum.repos.d]# vi local.repo
3 编辑local.repo
[base]
name=CentOS
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
4 清除yum缓存
[root@localhost yum.repos.d]# yum clean all

 

你可能感兴趣的:(Linux,linux,yum)