- 配置仓库
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# vi rpm.repo
仓库代码:
[BaseOS]
name=BaseOS
baseurl=/mnt/BaseOS
enabled=1
gpgcheck=0[AppStream]
name=AppStream
baseurl=/mnt/AppStream
enabled=1
gpgcheck=0
- 挂载
[root@localhost yum.repos.d]# mount /dev/sr0 /mnt/
mount: /mnt: WARNING: source write-protected, mounted read-only.
- 安装httpd软件包
[root@localhost yum.repos.d]# dnf install httpd -y
显示Complete!安装成功
- 启动服务
[root@localhost yum.repos.d]# systemctl start httpd
- 关闭防火墙
[root@localhost yum.repos.d]# systemctl stop firewalld
- 给网页写内容
[root@localhost yum.repos.d]# echo welcome to hahahhaha > /var/www/html/index.html
- 在浏览器中输入网址进行访问
- 进入
etc/httpd/conf.d
目录,编辑vhost.conf
配置文件
<directory /www>
allowoverride none
require all granted
</directory>
<virtualhost 192.168.209.136:80>
documentroot /www
servername 192.168.209.136
</virtualhost>
- 创建
/www
目录
[root@localhost conf.d]# mkdir /www
- 写内容到
/www/index.html
访问测试
[root@localhost conf.d]# echo welcome to xixi > /www/index.html
- 重启httpd服务
[root@localhost conf.d]# systemctl restart httpd
- 关闭防火墙
[root@localhost conf.d]# systemctl stop firewalld
- 关闭SELinux
[root@localhost conf.d]# setenforce 0
- 进入浏览器访问