#############creat local yumsource##############
mkdir /westos ##建立目录/westos
mount /iso/rhel-server-7.1-x86_64-dvd.iso /westos ##将镜像文件挂载到/westos
mkdir /backup ##建立目录/backup
mv /etc/yum.repos.d/* /backup ##将/etc下的干扰文件移动到/backup
cat > /etc/yum.repos.d/yum.repo <<end ##编辑仓库文件
[test]
name=test
baseurl=file:///westos
gpgcheck=0
end
yum clean all ##刷新仓库配置
##############install shareserver#####################
yum install httpd -y ##安装httpd
systemctl start httpd #启动httpd
systemctl enable httpd ##开机启动httpd
systemctl stop firewalld ##关闭防火墙
systemctl disable firewalld ##开机不启动防火墙
################mount iso to sharedirectory#############
umount /westos ##取消镜像文件挂载
mkdir /var/www/html/rhel7.1 ##在/var/www/html中建立目录/rhel7.1
mount/iso/rhel-server-7.1-x86_64-dvd.iso /var/www/html/rhel7.1 ##将镜像文件挂载到/rhel7.1
echo"/iso/rhel-server-7.1-x86_64-dvd.iso /var/www/html/rhel7.1 iso9660 ro 0 0" >> /etc/fstab
##将临时挂载改为永久挂载
##################cofig localyum######################
cat > /etc/yum.repos.d/yum.repo <<end ##重新编辑文件/yum.repo
[test]
name=test
baseurl=file:///var/www/html/rhel7.1
#baseurl=http://172.25.38.250/rhel7.1
gpgcheck=0
end
浏览器中输入http://172.25.38.250/rhel7.1查看yum源是否配置成功