The Ops Community ⚙️

Cover image for AMI 2 builds WordPress based on lamp
Feng Lei
Feng Lei

Posted on

AMI 2 builds WordPress based on lamp

The lamp + WordPress environment built this time is as follows

MySQL php
Wordpress 4.9 Apache
AMI 2 172.31.86.66

1. Install MariaDB, PHP, httpd, WGet

2. Test PHP

3. Download WordPress and configure

4. The web page enters the background

1、Master configuration

yum -y install mariadb mariadb-server php php-server wget php-fpm php-mysql
#Start httpd, MariaDB, and initialize mailadb

systemctl start mariadb httpd

mysql_secure_installation  #Set the database root user password
Enter fullscreen mode Exit fullscreen mode

2、Test php

echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php 
Open browser to access native IP
http://192.168.200.10/phpinfo.php
Enter fullscreen mode Exit fullscreen mode

Image description

3、Download WordPress and configure

# wget https://wordpress.org/wordpress-4.9.tar.gz
Enter fullscreen mode Exit fullscreen mode
You can download it to the computer first and then transfer it to the server
Tar decompression package
tar -zxf wordpress-4.9.tar.gz
Enter fullscreen mode Exit fullscreen mode
Log in to MySQL and create WordPress database and user
MariaDB [(none)]> create database `wordpress-db`;
MariaDB [(none)]> grant all privileges on `wordpress-db`.* to 'wordpress'@'localhost' identified by '000000';
MariaDB [(none)]> flush privileges;
Enter fullscreen mode Exit fullscreen mode

Image description

Create and edit WP config PHP file
[root@server ~]# cp wordpress/wp-config-sample.php wordpress/wp-config.php
[root@server ~]# vi wordpress/wp-config.php
Enter fullscreen mode Exit fullscreen mode
Modify database name, database user and password

Image description

Copy the contents of WordPress installation directory
mv /var/www/html/* /opt
cp -r wordpress/* /var/www/html/
Enter fullscreen mode Exit fullscreen mode
Allow WordPress to use Permalink
vi /etc/httpd/conf/httpd.conf 

Find the allowoverride in line 151 and modify it as follows
Enter fullscreen mode Exit fullscreen mode

Image description

Restart httpd and MariaDB services
[root@server ~]# systemctl restart httpd mariadb
Enter fullscreen mode Exit fullscreen mode

4、The web page enters the background

Enter the IP address of the browser for installation

Image description
Image description
Image description

Top comments (0)