LAMP:Linux、Apache、MySQL|MariaDB、PHP
Apache: The main program is httpd
httpd configuration file:
/etc/httpd/conf/httpd.conf main configuration file
/etc/httpd/conf.d/*.conf Snippet configuration files
MySQL|Mariadb:
The mysql_secure_installation script is used to initialize database security information
PHP:
You need to install php and php-mysql in the system to realize the connection function between php and database
Let's start building wordpress through LAMP: (Centos7)
First install the required files for httpd, mariadb, and php;
[root@localhost wordpress]# rpm -q php php-mysql mariadb httpd
php-5.4.16-43.el7_4.1.x86_64
php-mysql-5.4.16-43.el7_4.1.x86_64
mariadb-5.5.56- 2.el7.x86_64
httpd-2.4.6-67.el7.centos.6.x86_64
(I have installed the corresponding file here)
(If not installed: yum install php php-mysql mariadb httpd)
[root@localhost ~]# cd /etc/httpd/
Switch to the directory root file of httpd
[root@localhost httpd]# mkdir vhost/vhost1
Create a virtual host root directory
[root@localhost httpd]# vim conf.d/vhost1.conf
Create and edit virtual host configuration files
179.5.99.12 is the IP address of my virtual machine, and wr.yll.com is the access name I set for the virtual machine;
Note: Here you need to modify the local host file on the Windows host and redirect its access path (as shown below)
In order to ensure the normal operation of the httpd service, it is necessary to temporarily close the firewall and SELINUX of the Linux system at this time;
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]# iptables -vnL
Chain INPUT (policy ACCEPT 5230 packets, 7252K bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 3464 packets, 3248K bytes)
pkts bytes target prot opt in out source destination
(If there are firewall rules, use iptables -F to clear them)
[root@localhost ~]# cd /etc/httpd/vhost/vhost1/
[root@localhost vhost1]# touch index.html
[root@localhost vhost1]# echo “hello my vhost1” > index.html
At this point, we switch to the following directory of the virtual host and create a home page file for it; write something in the file to test whether the httpd service is running normally; (here I write hello my vhost1)
Enter wr.yll.com in any browser, and the following results indicate that the httpd service is successfully started;
Let's pass the wordpress compressed package into our virtual host root directory;
Here wordpress-4.2-zh_CN.tar.gz is the compressed package file of wordpress;
(tar -xf wordpress-4.2-zh_CN.tar.gz The wordpress directory appears after decompression)
At this point, enter wr.yll.com/wordpress in any browser and the following installation page will appear
After the start, the corresponding information needs to be filled in; in this matter, it should be noted that the database information required to be filled in must be a database that already exists in advance;
At this point we need to create a database: (-p enter the password you set during pre-initialization, if there is no march security initialization, there is no password, just enter mysql to enter)
[root@localhost vhost2]# mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statemen
MariaDB [(none)]> create database test_db;
Query OK, 1 row affected (0.00 sec)
At this point, we can see the newly created database test_db, and enter the corresponding database information on the browser installation page;
If there is a problem, you can try restarting the mariadb service on Centos7 (systemctl restart mariadb.service) or carefully check whether the corresponding information is incorrect; after success, enter the following page:
Create the file as it asks and copy the text into its file:
After completion, click to install to complete;
At this point, we have realized the use of LAMP to implement wordpress installation on the site;