WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database with supported HTTPS. Features include a plugin architecture and a template system, referred to within WordPress as Themes.
Install WordPress on centOS; Through this tutorial, we will learn how to install wordpress with mysql on centOS 8.
How to Install WordPress on CentOS 8
Follow the following steps to install wordpress with mysql on centOS 8:
- Step 1 – Create MySQL Database
- Step 2 – Download WordPress
- Step 3 – Extract WordPress Zip
- Step 4 – Configure WordPress with Database
- Step 5 – Test WordPress Installation
Step 1 – Create MySQL Database
First of all, open terminal or command line and execute the following command into it to setting up the database:
mysql -u root -p
When prompted, enter MySQL root password that you set up when installing MySQL.
In MySQL, enter the following commands:
create database wordpress character set utf8 collate utf8_bin;
Make sure set own secure password where it says [insert-password-here]
grant all privileges on wordpress.* to [email protected] identified by '[insert-password-here]';
Step 2 – Download WordPress
Execute the following command on command line or terminal to download the latest version of WordPress:
Note: if wget is not installed, install it by running the command:
yum install wget
Step 3 – Extract WordPress Zip
Execute the following command on command line or terminal to decompress dowloaded file:
tar -xzvf latest.tar.gz
Step 4 – Configure WordPress with Database
Next, we need to copy wp-config-sample.php to wp-config.php which is where WordPress gets its base configuration. To do that run:
cp wordpress/wp-config-sample.php wordpress/wp-config.php
In our favorite text editor, edit wordpress/wp-config.php
For a basic setup, we need to have the following:
define(‘DB_NAME’, ‘wordpress’); define(‘DB_USER’, ‘wordpressuser’); define(‘DB_PASSWORD’, ‘[insert-password-here]’);
Next, execute the following command on command line or terminal to move the WordPress folder to our web directory.
sudo cp -r ~/wordpress/* /var/www/html
Step 5 – Test WordPress Installation
Open the browser and hit the following URL into it to test WordPress installation:
Through this tutorial, we have learned how to install WordPress with MySQL on centOS 8.