[LINUX] Build WordPress on CentOS 8 in LAMP environment

Introduction

This time I wrote last time CentOS 8 installation procedure (latest version)

Following the above article, I would like to build WordPress on CentOS 8 in a LAMP environment (Linux / Apache / MariaDB / PHP).

If it gets too long, I will post it separately, but I would like to explain it in an easy-to-understand manner.

I will write it for beginners such as "I was able to install it last time, but what do I do with Linux after all?", "I want to build WordPress that I often hear in the streets locally".

This goal

--To the point where WordPress can be built locally in a LAMP environment

Development environment

--VirtualBox (using the one installed last time) --CentOS8 (using the one installed last time)

Construction procedure

  1. Check the time zone

  2. Install Apache

  3. PHP installation

  4. Install WordPress

  5. MariaDB installation

  6. wp-config.php settings

I would like to follow the above procedure.

Explanation of construction procedure

Time zone confirmation

--I think that the time zone was set to ** Asia / Tokyo ** when CentOS 8 was installed, but check if it is set here with the following command.

terminal



timedatectl

--If the time zone is not set to ** Asia / Tokyo **, change it with the following command and check it.

terminal



su - //Become root with the password you set for root.

timedatectl set-timezone Asia/Tokyo //Asia with this command/Changed to Tokyo.

timedatectl //Check if it has been changed by the command you entered earlier.

Apache installation

--Next, we will install Apache.

terminal



dnf -y install httpd
Install Apache with this command.

httpd -v
Check the version of Apache installed with this command.
version: Apache/2.4.If you see something like 37, you have installed.

systemctl enable httpd
Set to automatically start Apache installed by this command.

systemctl start httpd
Start Apache with this command.

systemctl status httpd
Use this command to check if Apache is started.
Active if started normally(running)It should be.

――Check if you have done so far without any problems.

--If you access FireFox, enter localhost in the URL and check the following page, you have no problem.

Apache.PNG

PHP installation

terminal



dnf -y install php php-mysqlnd php-pecl-json
Install PHP with this command.

systemctl restart httpd
Use this command to restart Apache, which was still running after installation, and apply it.

php -v
Use this command to check the PHP version and make sure you have installed it.

WordPress installation

terminal



dnf -y install wget
After installing this command, wget[option]You can download the file with the URL specified in URL.

cd /var/www/html
This command will take you to the hierarchy where you want to place the wordpress files.

wget https://ja.wordpress.org/latest-ja.tar.gz
This command will download the latest version of wordpress from the site.

tar xvf latest-ja.tar.gz
Extract the wordpress file you downloaded earlier with this command.
※at this point/var/www/Work with html.

chown -R apache:apache .
Grant permissions with this command.

MariaDB installation

terminal



#mysql This command connects to MariaDB.
MariaDB on the left after connection[(none)] >It should be written like this.

MariaDB [(none)]> create database wordpress default character set utf8;
Create a database with this command.
(This time, I created it with the name wordpress for easy understanding, but there is no problem with any name here.)

show databases;
Use this command to check if it has been created.(There is no problem if you have a database with the name you gave it when you created it.)

MariaDB [(none)]> grant all on wordpress.* to wordpress@localhost identified by 'password';
This command creates a user named wordpress who has full privileges only on the database created earlier.
(This time, wordpress and password are used for clarity, but please create any user name and password.)

MariaDB [(none)]> flush privileges;
This command reloads from the grant table in the database.

wp-config.php settings

terminal



cd /var/www/html/wordpress
This command will take you to the hierarchy within wordpress.

cp wp-config-sample.php wp-config.php
Copy the sample of the config file with this command, and edit the copied one with an editor.

vim wp-config.php
This command will enter the config file.

--When you open the config file with an editor, the database name / database user name / database password will be changed to the one you set earlier.

--Looking at the bottom of the config file, it says to change the unique key, but if you search for the URL in the config file or ** wordpress private key service ** and click it, it will be automatically generated, so copy it. & I think that there is no problem if you paste and use it.

WordPress initial settings

--Access localhost / wordpress / with a web browser to initialize wordpress. wordpress1.PNG

――This is the next screen of "Let's get started". wordpress2.PNG

--When the installation is completed normally, the following screen will be displayed. wordpress5.PNG

--Click on the house-shaped icon in the upper left corner of the dashboard and you should see the screen below.

wordpress4.PNG

Supplement (when such an error occurs)

―― "It seems that PHP on your server does not have the MySQL extensions required for WordPress."

This error occurs when MariaDB's PHP extension is not installed, so it is likely to be fixed by reinstalling PHP. (This may not fix it. This is just an example.)

I think this error is the most common in building WordPress. As a common pattern, there are various causes such as mistakes in the setting of wp-config.php and lack of DB authority, but since it is mostly around wp-config.php and DB, I think that it is good to check that area first. ..

Finally

I posted the second article on Qiita this time!

The user name and password are set so that they are easy to understand in the image, but since such settings should not be set originally, please build while considering security when creating in a non-local production environment. This time, I have omitted the firewall settings, etc., and in reality, I may set more.

I installed CentOS 8 last time, and this time I built WordPress locally in a LAMP environment. I intended to make it easy for beginners to understand, but I would like to do as much as I can if there are things such as "It is difficult to understand here" or "I want you to write such an article".

Next time, I would like to write an article that monitors the web server created this time by building a monitoring server using Zabbix separately from the server built by WordPress. (If in demand)

Recommended Posts

Build WordPress on CentOS 8 in LAMP environment
Build a LAMP environment [CentOS 7]
Build a python3 environment on CentOS7
Build CentOS8 LAMP
Install LAMP on Amazon Linux 2 and build a WordPress environment.
Build a LAMP environment on your local Docker
Build a LAMP environment in a very short time
Build a python environment with ansible on centos6
Anaconda environment construction on CentOS7
Build python environment on windows
Build a python environment on CentOS 7.7 for your home server
Build Python 3.8 + Pipenv environment on Ubuntu 18.04
Build a Selenium environment on Amazon Linux 2 in the shortest time
Shell script to build pyenv environment on ubuntu in one shot
Python 2.7, 3.4, 3.5 extension module build environment on Windows
Method to build Python environment in Xcode 6
Build Python3 and OpenCV environment on Ubuntu 18.04
Build a python environment on MacOS (Catallina)
Build an LNPP environment on Amazon Linux 2
Build Python environment with Anaconda on Mac
Build jupyter notebook on remote server (CentOS)
Build OpenCV-Python environment on Raspberry Pi B +
Build a Python + OpenCV environment on Cloud9
Install rJava on Linux in R3.6 environment.
Build CentOS 8 on ESXi 6.7 with minimal configuration
Summary of how to build a LAMP + Wordpress environment with Sakura VPS
Stray build Python-3.8.5 on CentOS without root privileges
Build a WardPress environment on AWS with pulumi
System switching occurs in a CentOS 7 cluster environment
Build python environment with pyenv on EC2 (ubuntu)
Build Python3.5 + matplotlib environment on Ubuntu 12 using Anaconda
Simply build a Python 3 execution environment on Windows
[Latest] How to build Java environment on Ubuntu
Install python package in personal environment on Ubuntu
Build a Django environment on Raspberry Pi (MySQL)
Build a Python environment on Mac (Mountain Lion)
Build a Python development environment on your Mac
Build Python3 + flask environment on GCP Compute Engine
Build a Kubernetes environment for development on Ubuntu
Build a Minecraft plugin development environment in Eclipse
How to build Java environment on Ubuntu (Linux)
Build a PYNQ environment on Ultra96 V2 and log in to Jupyter Notebook
[TF] How to build Tensorflow in Proxy environment
Build a Python development environment on Raspberry Pi
Build an Arch Linux environment on Raspberry Pi
[CentOS 7.3] Build an FTP server on the ESXi host
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Build an OpenCV4 environment on Raspberry Pi using Poetry
Install Python3 on Mac and build environment [Definitive Edition]
Build a Django development environment using pyenv-virtualenv on Mac
Build an interactive environment for machine learning in Python
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
Build a local development environment for Laravel6.X on Mac
Build a machine learning Python environment on Mac OS
Build a GVim-based Python development environment on Windows 10 (1) Installation
How to build a Django (python) environment on docker
Build a Python development environment on Mac OS X
Build a Python environment on your Mac using pyenv
Build a Python development environment using pyenv on MacOS
How to build a Python environment on amazon linux 2
Build a machine learning environment natively on Windows 10 (x64)