1.部署LAMP架构
1.1准备工作
关闭防火墙和Seliunx
[root@localhost ~]# systemctl stop firewalld && setenforce 0
1.2部署架构
LAMP = Liunx + Apache + MySQL + PHP
安装Apache、MySQL、PHP
[root@localhost ~]# yum -y install httpd mariadb-server mariadb php php-mysql gd php-gd
2.启动Apache
[root@localhost ~]# systemctl start httpd #启动Apache
[root@localhost ~]# systemctl enable httpd #设置Apache服务开机自启
3.启动Mariadb
[root@localhost ~]# systemctl start mariadb #启动
[root@localhost ~]# systemctl enable mariadb #设置Mariadb服务开机自启
4.查看80端口是否开启
[root@localhost ~]# ss -lntp | grep 80
LISTEN 0 128 :::80 :::* users:(("httpd",pid=1401,fd=4),("httpd",pid=1400,fd=4),("httpd",pid=1399,fd=4),("httpd",pid=1398,fd=4),("httpd",pid=1397,fd=4),("httpd",pid=1395,fd=4))

image.png
5.设置MySQL
[root@localhost ~]# mysql #登录MySQL
MariaDB [(none)]> create database wordpress; #创建wordpress
MariaDB [(none)]> create user '自定义用户'@'localhost' identified by '定义用户密码'; #创建用户和密码
MariaDB [(none)]> grant all on wordpress.* to '用户'@'localhost'; #用户授权
MariaDB [(none)]> flush privileges; #刷新权限
MariaDB [(none)]> show databases; # 查看是否有wordpress库
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| wordpress |
+--------------------+
5 rows in set (0.01 sec)
MariaDB [(none)]> exit; #退出数据库
6.下载并上线wordpress
[root@localhost ~]# wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz #下载wordpress包
[root@localhost ~]# tar xf wordpress-4.9.4-zh_CN.tar.gz #解压wordpress包
[root@localhost ~]# cp -rf wordpress/* /var/www/html #复制到网站主目录
[root@localhost ~]# chown -R apache.apache /var/www/html #设置目录权限

image.png

image.png

image.png

image.png

image.png

image.png

image.png