During the experiment, several virtual machines (minimum installation) need to be opened to mount the image directly to configure the yum source, without copying the iso to the virtual machine, so as to reduce the disk occupation;
Check whether the virtual machine mounts the image
Check whether the mount directory is mounted
Check whether there are other files in this directory. If cdrom is not created, mount / dev/sr0 to this directory again
[root@localhost ~]# cd /media/
[root@localhost media]# ls
cdrom
Create a cdrom directory mount in another directory:
[root@localhost ~]# mount -o loop /dev/sr0 /mnt/cdrom
Check whether the mount is successful again:
[root@localhost media]# df
/dev/sr0 3654720 3654720 0 100% /media/cdrom
/dev/loop0 3654720 3654720 0 100% /mnt/cdrom
Configure yum source:
[root@localhost media]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# cat yum.repo
[rhel7.0]
name=redhat7.0
baseurl=file:///mnt/cdrom
enable=1 ###1 means enabled, 0 means not enabled
gpgkey=1 ###gpg check or not, 1 means check, 0 means no check
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
###Define the address to check gpgkey
To see if the configuration is complete:
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel7.0
Cleaning up everything
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel7.0 | 4.1 kB 00:00
(1/2): rhel7.0/group_gz | 134 kB 00:00
(2/2): rhel7.0/primary_db | 3.4 MB 00:00
repo id repo name status
rhel7.0 redhat7.0 4,305
repolist: 4,305