更新时间:2019-10-29 来源:黑马程序员 浏览量:
环境说明:当前系统版本为RedHat8.0系统
1、基础环境配置
(1)关闭防火墙和selinux
临时关闭防火墙
[root@rhel8 ~]# systemctl stop firewalld.service
下次开机不自动启动
[root@rhel8 ~]# systemctl disable firewalld.service
[root@rhel8 ~]# systemctl list-unit-files |grep firewalld
firewalld.service disabled
关闭selinux
[root@rhel8 ~]# setenforce 0
[root@rhel8 ~]# getenforce
Permissive
[root@rhel8 ~]# vim /etc/selinux/config
...
SELINUX=disabled
....
(2)配置本地软件仓库
手动挂载光盘到本地/mnt下
[root@rhel8 ~]# mount -o ro /dev/sr0 /mnt
开机自动启动
[root@rhel8 ~]# echo "mount -o ro /dev/sr0 /mnt" >> /etc/rc.local
[root@rhel8 ~]# chmod +x /etc/rc.d/rc.local
修改配置文件指定软件仓库
[root@rhel8 ~]# cd /etc/yum.repos.d/
[root@rhel8 yum.repos.d]# cat local.repo
[BaseOS]
name=BaseOS yum
baseurl=file:///mnt/BaseOS/
enabled=1
gpgcheck=0
[App]
name=Appstream yum
baseurl=file:///mnt/AppStream/
enabled=1
gpgcheck=0
2、一键构建LAMP环境
(1) 安装Apache(httpd)软件
说明:RedHat8默认自带httpd-2.4.37版本
[root@rhel8 ~]# yum install httpd -y(2)安装PHP相关软件
说明:RedHat8默认php-7.2版本
yum -y install php-xml-7.2.11-1.module+el8+2561+1aca3413.x86_64 \(3) 安装Mariadb数据库软件
说明:从RedHat7以后,系统默认自带Mariadb数据库
[root@rhel8 ~]# yum install mariadb-server mariadb
3、启动相应服务
(1)启动后台数据库
[root@rhel8 ~]# systemctl start mariadb.service(2)启动前端web服务
[root@rhel8 ~]# systemctl start httpd.service4、测试是否可以解析php页面
[root@rhel8 ~]# vim /var/www/html/index.php
推荐了解:黑马程序员linux云计算+运维开发培训课程。
【AI设计】北京143期毕业仅36天,全员拿下高薪offer!黑马AI设计连续6期100%高薪就业
2025-09-19【跨境电商运营】深圳跨境电商运营毕业22个工作日,就业率91%+,最高薪资达13500元
2025-09-19【AI运维】郑州运维1期就业班,毕业14个工作日,班级93%同学已拿到Offer, 一线均薪资 1W+
2025-09-19【AI鸿蒙开发】上海校区AI鸿蒙开发4期5期,距离毕业21天,就业率91%,平均薪资14046元
2025-09-19【AI大模型开发-Python】毕业33个工作日,就业率已达到94.55%,班均薪资20763元
2025-09-19【AI智能应用开发-Java】毕业5个工作日就业率98.18%,最高薪资 17.5k*13薪,全班平均薪资9244元
2025-09-19