镜像下载网站
1、ISO镜像下载网站:
网易镜像: http://mirrors.163.com/
阿里镜像: https://opsx.alibaba.com/mirror # 亲测可用。点进去,选择ISO文件,点击即开始下载
centos中文站: https://www.centoschina.cn/downloads
2、ISO镜像文件上传:(根据情况选择版本)
# ls /mnt/CentOS-7-x86_64-DVD-1708.iso
/mnt/CentOS-7-x86_64-DVD-1708.iso
3、创建虚拟光驱的目录(用于挂载iso文件)
mkdir -p /mnt/repo-CentOS7/
4、挂载:
# mount -o loop -t iso9660 /mnt/CentOS-7-x86_64-DVD-1708.iso /mnt/repo-CentOS7/
此处 -t 用于指定文件类型,也可以不指定,Linux自动判断
# df -Ph
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 50G 17G 31G 35% /
tmpfs 16G 648K 16G 1% /dev/shm
/dev/sda1 485M 35M 426M 8% /boot
/dev/mapper/VolGroup-lv_home 1.8T 32G 1.6T 2% /home
/dev/loop0 4.3G 4.3G 0 100% /mnt/repo-CentOS7
5、复制光盘文件到本地目录:
# mkdir /var/yum/repo-CentOS7
# cp /mnt/repo-CentOS7/* /var/yum/repo-CentOS7
6、取消ISO挂载:
# umount /mnt/repo-CentOS7/