Install WordPress on Rocky Linux 9 [Step-by-Step]

WordPress is a free CMS (Content Management System), content management system written using PHP and MySQL, licensed under the GPL. WordPress is a platform where all kinds of content can be edited and published, not just as an article writing and editing or blogging system.

64.4% of known content management systems and 43% of all websites use WordPress. Let's talk about installing this popular CMS software on Rocky Linux 9.



Steps to install WordPress

Let's explain the installation step by step.


Step 1: Install Httpd and LAMP Stack

For the Wordpress web interface, the httpd package is first installed:

[foc@rocky9 ~]$ sudo dnf install httpd -y

Then httpd service is enabled:

[foc@rocky9 ~]$ sudo systemctl enable httpd
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/httpd.service.

And the service is started:

[foc@rocky9 ~]$ sudo systemctl start httpd

Added firewall rules for httpd service:

[foc@rocky9 ~]$ sudo firewall-cmd --add-service=http --permanent 

[foc@rocky9 ~]$ sudo firewall-cmd --reload

LAMP stack is a group of open-source software that is typically installed together to enable a server to host dynamic websites and web apps. You can find more detailed information about LAMP Stack installation in our "Install LAMP Stack on Rocky Linux 8 [Step-by-Step]" article. Now let's proceed by installing the necessary LAMP Stack packages for Wordpress installation:

[foc@rocky9 ~]$ sudo dnf install -y php php-zip php-intl php-mysqlnd php-dom php-simplexml php-xml php-xmlreader php-curl php-exif php-ftp php-gd php-iconv php-json php-mbstring php-posix php-sockets php-tokenizer

This step is complete


Step 2: Create the Database and a User

If you want to do database operations with phpMyAdmin, not from the terminal, you can review the "Install phpMyAdmin on Rocky Linux 9 [Step-by-Step]" article for phpMyAdmin installation.

For MariaDB Server, install the following package:

[foc@rocky9 ~]$ sudo dnf -y install mariadb-server

The service is enabled:

[foc@rocky9 ~]$ sudo systemctl enable mariadb.service
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/mariadb.service.

Then the service is started:

[foc@rocky9 ~]$ sudo systemctl start mariadb.service

We will create a database for user, password and wordpress in MariaDB. Enter MariaDB:

[foc@rocky9 ~]$ sudo mysql -uroot
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.5.16-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

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

MariaDB [(none)]> CREATE USER 'wp_foc'@'localhost' IDENTIFIED BY 'Pp123456';
Query OK, 0 rows affected (0.005 sec)

MariaDB [(none)]> GRANT ALL ON mywordpress_db.* TO 'wp_foc'@'localhost';
Query OK, 0 rows affected (0.005 sec)

Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> exit;

We entered the following values, make a note of the information you entered:

  • Database: mywordpress_db
  • User Name: wp_foc
  • Password: Pp123456


Step 3: Download and Extract WordPress

Install the following packages for Wordpress download and unzip:

[foc@rocky9 ~]$ sudo dnf install wget unzip -y

Download wordpress with wget:

[foc@rocky9 ~]$ wget
--2022-10-03 10:43:52--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 22772803 (22M) [application/zip]
Saving to: ‘’ 100%[=============================>] 21.72M 1.81MB/s in 11s

2022-10-03 10:44:03 (1.99 MB/s) - ‘’ saved [22772803/22772803]

Extracting from zip file:

[foc@rocky9 ~]$ unzip

Move the wordpress directory under /var/www/html/:

[foc@rocky9 ~]$ sudo mv wordpress /var/www/html/

Authorize Wordpress directory and subdirectories:

[foc@rocky9 ~]$ sudo chown -R apache:apache /var/www/html/wordpress
[foc@rocky9 ~]$ sudo chmod -R 775 /var/www/html/wordpress

Configure the SELinux context for the directory and its contents:

[foc@rocky9 ~]$ sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/wordpress(/.*)?"
[foc@rocky9 ~]$ sudo restorecon -Rv /var/www/html/wordpress

The wp-config-sample.php file is renamed to wp-config.php:

[foc@rocky9 ~]$ sudo mv /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php

The following changes are then applied:

[foc@rocky9 ~]$ sudo vi /var/www/html/wordpress/wp-config.php

define( 'DB_NAME', 'mywordpress_db' );

/** Database username */
define( 'DB_USER', 'wp_foc' );

/** Database password */
define( 'DB_PASSWORD', 'Pp123456' );

Finally, http service is restarted:

[foc@rocky9 ~]$ sudo systemctl restart httpd


Step-4 Login Wordpress GUI

After package installations, type http://serverip_address/wordpress into a web browser:

For example:

  • Site Title
  • Username
  • Password
  • Your Email

Enter the above information and press the Install Wordpress button.

Install WordPress on Rocky Linux 9 [Step-by-Step]

Make a note of your username and password.

Install WordPress on Rocky Linux 9 [Step-by-Step]

Enter your username and password.

Install WordPress on Rocky Linux 9 [Step-by-Step]

Welcome to WordPress!


The current Wordpress installation is complete.



The popular CMS software Wordpress was installed in this article. System resources may vary depending on the type of content you want to install. Let's share an example source:

  • Disk space: At least 1 GB.
  • Database: MySQL 5.015 or higher
  • RAM: At least 512 MB.
  • CPU: At least 1.0 GHz.


Preferences - How to install WordPress


Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment