Centos7 uses ISO image files as offline Yum sources

Time:2021-4-15
  1. CentOS Download Image

Official website address: https://www.centos.org/download/
Domestic image address: https://mirrors.aliyun.com/centos/7/isos/x86_ 64/

Domestic image is recommended

  1. Create ISO storage directory and mount directory
mkdir /mnt/iso /mnt/cdrom
  1. Upload ISO image file to / MNT / ISO

  2. Mount ISO image to mount directory

mount -o loop /mnt/iso/*.iso /mnt/cdrom

5. Check whether the mount is successful

df -h
  1. Backup / etc/ yum.repos . D file to backup folder

  2. Create a repo file and store it

touch local.repo
mv ./local.repo /etc/yum.repos.d
  1. Write information to local.repo
[local]
name=local
#Mount address: MNT / CDROM
baseurl=file:///mnt/cdrom    
enabled=1                    
gpgcheck=0
#CD / MNT / CDROM / you can see the key
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-7
  1. Test Yum installation
yum clean all
yum install ntp
  1. Unmount
umount /mnt/cdrom