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".
--To the point where WordPress can be built locally in a LAMP environment
--VirtualBox (using the one installed last time) --CentOS8 (using the one installed last time)
Check the time zone
I would like to follow the above procedure.
--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.
--If the time zone is not set to ** Asia / Tokyo **, change it with the following command and check it.
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.
--Next, we will install Apache.
dnf -y install httpd
Install Apache with this command.
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.
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.
Use this command to check the PHP version and make sure you have installed it.
dnf -y install wget
After installing this command, wget[option]You can download the file with the URL specified in URL.
This command will take you to the hierarchy where you want to place the wordpress files.
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.
#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.)
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.
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.
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.
--Access localhost / wordpress / with a web browser to initialize wordpress.
――This is the next screen of "Let's get started".
--When the installation is completed normally, the following screen will be displayed.
--Click on the house-shaped icon in the upper left corner of the dashboard and you should see the screen below.
―― "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. ..
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)