- [root@master ~]# mkdir -p /var/www/html
使用安装系统的ISO镜像文件rhel-server-7.3-x86_64-dvd.iso
把rhel-server-7.3-x86_64-dvd.iso镜像复制到http服务器(选择master机器)的默认目录/var/www/html下
- [root@master ~]# cd /var/www/html
- [root@master html]# ls
- rhel-server-7.3-x86_64-dvd.iso
在/var/www/html目录下创建文件夹RedHat
- [root@master html]# mkdir RedHat
- [root@master html]# ls
- RedHat rhel-server-7.3-x86_64-dvd.iso
将ISO文件挂载至文件夹/var/www/html/RedHat下
- [root@master html]# mount -o loop rhel-server-7.3-x86_64-dvd.iso RedHat/
(取消挂载 umount /var/www/html/RedHat)
查看文件夹/var/www/html/RedHat
- [root@master html]# ls /var/www/html/RedHat/
挂载完成后,进入/etc/yum.repos.d目录,创建rhel-media.repo:
- [root@master html]# cd /etc/yum.repos.d/
- [root@master yum.repos.d]# touch rhel-media.repo
- [root@master yum.repos.d]# ls
- rhel-media.repo
修改rhel-media.repo,删去原有内容并写入如下内容:
- [root@master yum.repos.d]# sudo gedit /etc/yum.repos.d/rhel-media.repo
- [RedHat7-media]
- name=RedHat7
- enabled=1
- baseurl=file:///var/www/html/RedHat
- gpgcheck=1
- gpgkey=file:///var/www/html/RedHat/RPM-GPG-KEY-redhat-release
- [root@master yum.repos.d]# cat rhel-media.repo
运行如下命令:
- #清除yum的缓存、头文件、已下载的软件包等等
- yum clean all
- #重建yum缓存
- yum makecache
- #查看已启用的镜像源
- yum repolist all
ISO镜像yum源搭建OK!!!