linux真机搭建web服务共享光盘所有内容

1.检测是否安装httpd 软件包

rpm -q httpd

httpd-2.4.6-67.el7.centos.x86_64
2.重启服务,并且设置开机自启动
# systemctl restart httpd
[root@room9pc01 ~]# systemctl enable httpd
3.创建目录
# mkdir /var/www/html/rhel7
4.挂载yum镜像

mount /iso/rhel-server-7.4-x86_64-dvd.iso /var/www/html/rhel7

5.验证软件包是否挂载
]# ls /var/www/html/rhel7/
addons images repodata
EFI isolinux RPM-GPG-KEY-redhat-beta
EULA LiveOS RPM-GPG-KEY-redhat-release
extra_files.json media.repo TRANS.TBL
GPL Packages

  1. 访问本机是否可以访问

firefox 192.168.4.254/rhel7

7.设置开机自动挂载

ls -l /iso

lrwxrwxrwx 1 root root 27 1月 23 2018 /iso -> /var/lib/libvirt/images/iso

ls /iso/

CentOS-7-x86_64-DVD-1708.iso rhel-server-7.4-x86_64-dvd.iso
lost+found Win10_Pro_X64_zh_CN.iso
rhel-server-6.7-x86_64-dvd.iso

vim /etc/fstab

/var/lib/libvirt/images/iso/rhel-server-7.4-x86_64-dvd.iso /var/www/html/rhel7 iso9660 defaults 0 0
8.检测挂载

mount -a

9.查看挂载
df -h
10.设置为yum源

rm -rf /etc/yum.repos.d/rhel7.repo

vim /etc/yum.repos.d/rhel7.repo

]# cat /etc/yum.repos.d/rhel7.repo
[rhel7]
name=rhel7
baseurl=http://192.168.4.254/rhel7
enabled=1
gpgcheck=0
11.检测yum源软件包
[root@room9pc01 yum.repos.d]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
源标识 源名称 状态
rhel7 rhel7 4,986
repolist: 4,986

上一篇:shell基础(二)cut用法


下一篇:函数计算搭建小程序Web应用后端服务