# Centos 7 yum source to build LAMP environment and deploy WordPress blog system

The environment construction process is as follows

  1. Turn off the system firewall and selinux
[root@LAMP ~]# systemctl stop firewalld 
[root@LAMP ~]# systemctl disable firewalld
[root@LAMP ~]# vim /etc/selinux/config 
.....
SELINUX=disabled
.....
[root@LAMP ~]# setenforce 0     //执行这个生效配置

Note: Because there is no mysql software package in the centos 7 source, we use mariadb database instead of mysql database.
If you really want to use mysql database, then you need to separately download the rpm package corresponding to mysql

[root@LAMP ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
[root@LAMP ~]# rpm -ivh mysql57-community-release-el7-11.noarch.rpm 
##下载包含mysql数据库的yum源仓库,然后在进行下载即可,如果系统存在一些mariadb包,那么请使用yum remove -y mariadb* 来进行删除即可

2. Install the software required for the LAMP environment`

[root@LAMP ~]# yum install -y httpd mariadb mariadb-server php php-mysql
#执行以上这个命令来进行安装即可

3. Then we start the Apache server

[root@LAMP ~]# systemctl start httpd
[root@LAMP ~]# ss -tan | grep 80
LISTEN     0      128       [::]:80                    [::]:*  

4. After the startup is complete, we write a PHP script to see if httpd can be resolved

[root@LAMP ~]# echo "<?php phpinfo(); ?>" > /var/www/html/index.php
#编写一个如上的PHP脚本

Browser access test
Insert picture description here
5. Open the mariadb database and then initialize

[root@LAMP ~]# systemctl start mariadb
[root@LAMP ~]# ss -tan | grep 3306
LISTEN     0      50           *:3306                     *:*    
[root@LAMP ~]# mysql_secure_installation 
#初始化数据库


6. Let's log in to test whether we can log in

[root@LAMP ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.65-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

7. Next we upload the WordPress blog system to the Linux server for decompression operation

[root@LAMP /]# ls
wordpress-4.9.4-zh_CN.tar.gz
[root@LAMP /]# tar -xf wordpress-4.9.4-zh_CN.tar.gz -C /var/www/html/
#然后我们进行解压操作解压到我们创建的目录下

8. Then we can go to the browser to access WordPress and install it

输入:IP地址/wordpress 即可访问
#注:如果不想要输入wordpress 向直接输入 IP地址就可以访问那么就需要修改httpd的配置文件了,如下:
[root@LAMP ~]# vim /etc/httpd/conf/httpd.conf 
119 DocumentRoot "/var/www/html/WordPress"
124 <Directory "/var/www/html/WordPress">
125     AllowOverride None
126     # Allow open access:
127     Require all granted
128 </Directory>
#修改以上指定的行即可

9. Then we enter the WordPress installation interface
Insert picture description here
and click to start now.
如果红箭头指的地方在mariadb数据库里面没有这个数据库,我们需要执行以下命令去进行创建 MariaDB [(none)]> create database wordpress;Insert picture description here
At the following step, you will be asked to create a file in the specified directory and copy the content given on the page into us for direct operation.
Insert picture description here
Then we can proceed. Set the various information of the site and the
Insert picture description herefinal login interface is as follows
Insert picture description here

**至此整个环境就搭建完成了,还是有很多不足的地方,待改进,还是一位正在努力的小白网工**

Guess you like

Origin blog.csdn.net/qq_45631844/article/details/108699898