Centos7挂载iso镜像

(1)创建挂载目录

 mkdir /mnt/cdrom

(2)挂载iso文件

 mount -t iso9660  /home/data/CentOS-7-x86_64-Everything-1708.iso /mnt/cdrom

(3)检查挂载

mount|grep cdrom

(4)自动挂载

vi /etc/fstab

/home/data/CentOS-7-x86_64-Everything-1708.iso /media/CentOS7 iso9660 defaults,ro,loop 0 0

(5)备份并新增yum源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
 vi /etc/yum.repos.d/CentOS7-Localsource.repo 

[CentOS7-Localsource]
name=CentOS7
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0

(6)清除,生成yum 缓存

yum clean all  
yum makecache

(7)测试安装gcc

yum -y install gcc

(8)取消挂载

umount  /mnt/cdrom/

 

你可能感兴趣的:(运维,挂载,centos,linux,运维)