How to Install WordPress on Rocky Linux 8

Prerequisites:

Wordpress requires LAMP stack installed and running

For detailed installation, refer to LAMP Stack on Rocky Linux 8

Creating the new database:

Log into MySQL with the following command,

mysql -u root -p

First, we'll create a new database,

CREATE DATABASE wordpress;

Next, create a new MySQL user account that we will use to operate on WordPress's new database, with username "admin"

CREATE USER `admin`@`localhost` IDENTIFIED BY '<Enter Strong Password here>';

Link the user and DB together by granting our user access to the database,

GRANT ALL ON wordpress.* TO `admin`@`localhost`;

Flush the privileges so that MySQL knows about the user permissions we just added,

FLUSH PRIVILEGES;

Exit out of the MySQL command prompt by typing,

exit

Output:

MariaDB [(none)]> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> CREATE USER `admin`@`localhost` IDENTIFIED BY '<Enetered Password>';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> GRANT ALL ON wordpress.* TO `admin`@`localhost`;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]>

Download and extract WordPress:

Download the wordpress by using curl command and extract the downloaded file

curl https://wordpress.org/latest.tar.gz --output wordpress.tar.gz

tar xf wordpress.tar.gz

Copy the extracted WordPress directory into the /var/www/html directory:

cp -r wordpress /var/www/html

File Permissions

Change permissions and change file SELinux security context:

chown -R apache:apache /var/www/html/wordpress

chcon -t httpd_sys_rw_content_t /var/www/html/wordpress -R

Allow Apache to access the internet to allow WordPress to download plugins and updates directly from WordPress.org,

setsebool -P httpd_can_network_connect true

Accessing WordPress

Navigate to the following URL via your browser

http://server_IP/wordpress

Start WordPress Installer

Start WordPress installation by clicking on "Run the installation" button:

Provide the requested information:

Once the wordpress is installed login with your new user credentials:


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS