1、基本信息描述
redhat版本:redhat 7.4
/tools/rhel-server-7.4-x86_64-dvd.iso
2、创建挂载目录与挂载ISO文件
[root@test2 /]# mkdir -p /mnt/cdrom
[root@test2 /]# mount -o loop /tools/rhel-server-7.4-x86_64-dvd.iso /mnt/cdrom/
mount: /dev/loop0 is write-protected, mounting read-only
[root@test2 tools]#
3、配置yum配置文件myself.repo
[root@test2 /]# cd /etc/yum.repos.d/
[root@test2 yum.repos.d]# ll
total 0
[root@test2 yum.repos.d]# vi myself.repo
[RedHat7]
name=RedHat7
baseurl=file:///mnt/cdrom
enabled=1
gpgckeck=0
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
4、清除缓存
[root@test2 yum.repos.d]# yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: RedHat7
Cleaning up everything
[root@test2 yum.repos.d]#
5、配置开机启动:
[root@test2 yum.repos.d]# vi /etc/fstab
/tools/rhel-server-7.4-x86_64-dvd.iso    /mnt/cdrom/    iso9660 defaults 0 0
6、成功性验证测试
[root@test2 yum.repos.d]# yum -y install gcc*
[root@test2 yum.repos.d]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5        25G  4.9G   21G  20% /
devtmpfs        487M     0  487M   0% /dev
tmpfs           497M     0  497M   0% /dev/shm
tmpfs           497M  6.7M  490M   2% /run
tmpfs           497M     0  497M   0% /sys/fs/cgroup
/dev/sda3       2.0G   33M  2.0G   2% /home
/dev/sda1      1014M  119M  896M  12% /boot
tmpfs           100M     0  100M   0% /run/user/0
/dev/loop0      3.8G  3.8G     0 100% /mnt/cdrom
[root@test2 yum.repos.d]#