Attach a Local CD to centos 7 as the image source
1. Upload the iso file to/usr/local/srcMake sure that the following operations are performed after the ISO file is uploaded.
2. Create the Mount directory mkdir/media/CentOS7
3. mount the iso file mount-t iso9660-o loop/usr/local/src/CentOS-7-x86_64-Everything-1503-01.iso/media/CentOS7
4. Set the automatic mounting of the CD image at startup
Run vi/etc/fstab
(If fstab is entered incorrectly, the host cannot be started normally and enters the emergency mode emergency state ,)
Add the last line (press I to enter edit mode, Press ESC to exit edit mode, and then enter: wq! Press enter to save and exit)
/Usr/local/src/CentOS-7-x86_64-Everything-1503-01.iso/media/CentOS7 defaults, ro, loop 0 0
5. Configure the source
Run vi/etc/yum. repos. d/CentOS7-Localsource.repo # To open the repo file, which is created if it does not exist
Press a to enter the editing mode
Enter the following content:
CentOS7-Localsource
Name = CentOS7
Baseurl = file: // media/Centos7
Enabled = 1
Gpgcheck = 0 Press ESC to exit edit input: wq press enter to save and then exit 6. generate local yum cache and execute yum makecache
Now the local ground source is set up!