目录
一、安装
1.关闭防火墙关闭selinux
iptables -F
systemctl stop firewalld
setenforce 0
2.安装apache
yum install httpd -y
3.配置主页
echo "index" > /var/www/html/index.html

二、部署mariadb(mysql)
1.用yum安装
yum install mariadb-server mariadb -y
2.启动数据库
systemctl restart mariadb
3.看下端口是否listen
netstat -tunlp | grep mysql

4登录mysql
mysql -hlocalhost -P3306 -uroot -p
第一次登录为空密码

5.修改下密码
use mysql
UPDATE user SET Password=PASSWORD ('123.com') where USER='root' and host='root' or host='localhost';
FLUSH PRIVILEGES;

登陆mysql后,简单的sql语句使用
show databases;
use mysql show tables;
desc user;
select user,host,password from user;
三、安装php
1.安装依赖包
yum install -y zlib-devel libxm12-devel libjpeg-devel libjpeg-turbo-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libtool-ltdl-devel pcre pcre-devel apr apr-devel zlib-devel gcc make
2.安装php解释器和php连接mysql驱动
yum install -y php php-mysql
3.配置apache然他支持php
vim /etc/httpd/conf/httpd.conf
TypesConfig /etc/mime.types
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html

4.手动编写php首页
vim /var/www/html/index.php
<meta charset=utf8>
<?php phpinfo(); ?>
重启一下服务
systemctl restart httpd
访问下站点

四、php连接mysql
vim /var/www/html/con.php
配置
<?php
$conn=mysql_connect('localhost','root','123.com');
if ($conn)
echo "php 已经连接上mysql";
else
echo "没连接成功";
?>
访问一下

五、lamp搭建论坛
1.下载论坛源代码

下载后上传一下源码

2.解压源码
mkdir Discuz
mv Discuz_X3.5_SC_UTF8_20231001.zip Discuz
cd Discuz
unzip Discuz_X3.5_SC_UTF8_20231001.zip
3.创建论坛主页目录
[root@localhost Discuz]# mkdir /www_Dis/
[root@localhost Discuz]# pwd
/root/Discuz
[root@localhost Discuz]# cp -R /root/Discuz/* /www_Dis/
[root@localhost Discuz]# cd /www_Dis/
[root@localhost www_Dis]# ls

改下权限
chmod 755 /www_Dis
主页移动
[root@localhost upload]# mv * /var/www/html/
mv: overwrite '/var/www/html/index.php'? y
[root@localhost upload]#

4.访问下主页

可以看到这里权限不够

修改下目录权限
chmod -R 777 /var/www/html/*

配置

安装完毕

访问
