How to install WordPress CMS on Rocky Linux 9.2
To Install WordPress On Rocky Linux 9.2
Introduction
WordPress is a popular open-source content management system (CMS). A Content Management System is a basic tool that makes it easy to manage important aspects of creating your own website or blog that was written in PHP.
Installation Steps:
Step 1: Check the OS version by using the below command
[root@Linuxhelp ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.2 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.2"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.2 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.2"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.2"
Step 2: Install Apache web server by using the below command
[root@Linuxhelp ~]# dnf install httpd -y
Rocky Linux 9 - BaseOS 3.1 kB/s | 4.1 kB 00:01
Rocky Linux 9 - AppStream 3.7 kB/s | 4.5 kB 00:01
Rocky Linux 9 - Extras 4.0 kB/s | 2.9 kB 00:00
Dependencies resolved.
======================================================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================================================
Installing:
httpd x86_64 2.4.53-11.el9_2.5 appstream 47 k
Installing dependencies:
apr x86_64 1.7.0-11.el9 appstream 123 k
apr-util x86_64 1.6.1-20.el9_2.1 appstream 94 k
apr-util-bdb x86_64 1.6.1-20.el9_2.1 appstream 12 k
Transaction Summary
======================================================================================================================================================================================================
Install 11 Packages
Total download size: 2.0 M
Installed size: 5.9 M
Downloading Packages:
(1/11): rocky-logos-httpd-90.14-1.el9.noarch.rpm 100 kB/s | 24 kB 00:00
(2/11): mod_lua-2.4.53-11.el9_2.5.x86_64.rpm 229 kB/s | 61 kB 00:00
(3/11): httpd-filesystem-2.4.53-11.el9_2.5.noarch.rpm 282 kB/s | 14 kB 00:00
(4/11): httpd-2.4.53-11.el9_2.5.x86_64.rpm 467 kB/s | 47 kB 00:00
(5/11): apr-util-openssl-1.6.1-20.el9_2.1.x86_64.rpm 290 kB/s | 14 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.5 MB/s | 2.0 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : apr-1.7.0-11.el9.x86_64 1/11
Installing : apr-util-bdb-1.6.1-20.el9_2.1.x86_64 2/11
Installing : apr-util-1.6.1-20.el9_2.1.x86_64 3/11
Installing : apr-util-openssl-1.6.1-20.el9_2.1.x86_64 4/11
Installing : httpd-tools-2.4.53-11.el9_2.5.x86_64 5/11
Installed:
apr-1.7.0-11.el9.x86_64 apr-util-1.6.1-20.el9_2.1.x86_64 apr-util-bdb-1.6.1-20.el9_2.1.x86_64 apr-util-openssl-1.6.1-20.el9_2.1.x86_64 httpd-2.4.53-11.el9_2.5.x86_64
httpd-core-2.4.53-11.el9_2.5.x86_64 httpd-filesystem-2.4.53-11.el9_2.5.noarch httpd-tools-2.4.53-11.el9_2.5.x86_64 mod_http2-1.15.19-4.el9_2.4.x86_64 mod_lua-2.4.53-11.el9_2.5.x86_64
rocky-logos-httpd-90.14-1.el9.noarch
Complete!
Step 3: Enable and Start the Apache web server by using the below command
[root@Linuxhelp ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@Linuxhelp ~]# systemctl start httpd
Step 4: Add firewall rules for httpd service and reload the firewall to apply changes by using the below command
[root@Linuxhelp ~]# firewall-cmd --add-service=http --permanent
success
[root@Linuxhelp ~]# firewall-cmd --reload
success
Step 5: Install PHP modules that are required for the installation of WordPress by using the below command
[root@Linuxhelp ~]# 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
Last metadata expiration check: 0:01:04 ago on Wednesday 18 October 2023 01:41:17 PM.
Dependencies resolved.
======================================================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================================================
Installing:
php x86_64 8.0.27-1.el9_1 appstream 10 k
php-common x86_64 8.0.27-1.el9_1 appstream 667 k
php-gd x86_64 8.0.27-1.el9_1 appstream 41 k
php-intl x86_64 8.0.27-1.el9_1 appstream 151 k
php-mbstring x86_64 8.0.27-1.el9_1 appstream 470 k
Transaction Summary
======================================================================================================================================================================================================
Install 15 Packages
Total download size: 7.0 M
Installed size: 37 M
Downloading Packages:
(1/15): nginx-filesystem-1.20.1-14.el9_2.1.noarch.rpm 43 kB/s | 8.5 kB 00:00
(2/15): libzip-1.7.3-7.el9.x86_64.rpm 283 kB/s | 62 kB 00:00
(3/15): php-pecl-zip-1.19.2-6.el9.x86_64.rpm 228 kB/s | 54 kB 00:00
(4/15): php-process-8.0.27-1.el9_1.x86_64.rpm 1.1 MB/s | 42 kB 00:00
(5/15): php-xml-8.0.27-1.el9_1.x86_64.rpm 1.2 MB/s | 131 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 4.8 MB/s | 7.0 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : php-common-8.0.27-1.el9_1.x86_64 1/15
Installing : php-pdo-8.0.27-1.el9_1.x86_64 2/15
Installing : php-xml-8.0.27-1.el9_1.x86_64 3/15
Installing : php-opcache-8.0.27-1.el9_1.x86_64 4/15
Installing : php-mbstring-8.0.27-1.el9_1.x86_64 5/15
Installing : php-cli-8.0.27-1.el9_1.x86_64
Installed:
libzip-1.7.3-7.el9.x86_64 nginx-filesystem-1:1.20.1-14.el9_2.1.noarch php-8.0.27-1.el9_1.x86_64 php-cli-8.0.27-1.el9_1.x86_64 php-common-8.0.27-1.el9_1.x86_64
php-opcache-8.0.27-1.el9_1.x86_64 php-pdo-8.0.27-1.el9_1.x86_64 php-pecl-zip-1.19.2-6.el9.x86_64 php-process-8.0.27-1.el9_1.x86_64 php-xml-8.0.27-1.el9_1.x86_64
Complete!
Step 6: Install MariaDB database server by using the below command
[root@Linuxhelp ~]# dnf -y install mariadb-server
Last metadata expiration check: 0:01:14 ago on Wednesday 18 October 2023 01:41:17 PM.
Dependencies resolved.
======================================================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================================================
Installing:
mariadb-server x86_64 3:10.5.22-1.el9_2 appstream 9.6 M
Installing dependencies:
mariadb x86_64 3:10.5.22-1.el9_2 appstream 1.6 M
mariadb-common x86_64 3:10.5.22-1.el9_2 appstream 27 k
Transaction Summary
======================================================================================================================================================================================================
Install 13 Packages
Total download size: 18 M
Installed size: 109 M
Downloading Packages:
(1/13): mariadb-connector-c-config-3.2.6-1.el9_0.noarch.rpm 44 kB/s | 9.8 kB 00:00
(2/13): mysql-selinux-1.0.5-1.el9_0.noarch.rpm 126 kB/s | 35 kB 00:00
(3/13): perl-Sys-Hostname-1.23-480.el9.x86_64.rpm 179 kB/s | 17 kB 00:00
(4/13): perl-File-Copy-2.34-480.el9.noarch.rpm 220 kB/s | 20 kB 00:00
(5/13): mariadb-server-utils-10.5.22-1.el9_2.x86_64.rpm 1.2 MB/s | 210 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 8.9 MB/s | 18 MB 00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mariadb-connector-c-config-3.2.6-1.el9_0.noarch 1/13
Installing : mariadb-common-3:10.5.22-1.el9_2.x86_64 2/13
Installed:
mariadb-3:10.5.22-1.el9_2.x86_64 mariadb-backup-3:10.5.22-1.el9_2.x86_64 mariadb-common-3:10.5.22-1.el9_2.x86_64 mariadb-connector-c-3.2.6-1.el9_0.x86_64
mariadb-server-utils-3:10.5.22-1.el9_2.x86_64 mysql-selinux-1.0.5-1.el9_0.noarch perl-DBD-MariaDB-1.21-16.el9_0.x86_64 perl-File-Copy-2.34-480.el9.noarch
perl-Sys-Hostname-1.23-480.el9.x86_64
Complete!
Step 7: Enable and Start the MariaDB service by using the below command
[root@Linuxhelp ~]# 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/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
[root@Linuxhelp ~]# systemctl start mariadb.service
Step 8: Create a database for WordPress for that need to connect the MariaDB by using the below command
[root@Linuxhelp ~]# mysql –u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.22-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.
Step 9: Once you are connected, create a database, user and assign the password. by using the below command
MariaDB [(none)]> CREATE DATABASE mywordpress_db;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> CREATE USER 'linuxhelp'@'localhost' IDENTIFIED BY 'Pp123456';
Query OK, 0 rows affected (0.001 sec)
Step 10: Grant all the privileges to the database user on the WordPress database by using the below command
MariaDB [(none)]> GRANT ALL ON mywordpress_db.* TO 'linuxhelp'@'localhost';
Query OK, 0 rows affected (0.001 sec)
Step 11: Flush the privileges and exit from the MariaDB by using the below command
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> exit;
Bye
Step 12: Install the following packages for wordpress download and unzip by using the below command
[root@Linuxhelp ~]# dnf install wget unzip -y
Last metadata expiration check: 0:03:22 ago on Wednesday 18 October 2023 01:41:17 PM.
Package wget-1.21.1-7.el9.x86_64 is already installed.
Package unzip-6.0-56.el9.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
Step 13: Download wordpress by using wget command
[root@Linuxhelp ~]# wget https://wordpress.org/latest.zip
--2023-10-18 13:44:49-- https://wordpress.org/latest.zip
Resolving wordpress.org (wordpress.org)... 198.143.164.252
Connecting to wordpress.org (wordpress.org)|198.143.164.252|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24962936 (24M) [application/zip]
Saving to: ‘latest.zip’
latest.zip 100%[===========================================================================================================>] 23.81M 7.55MB/s in 3.8s
2023-10-18 13:44:54 (6.24 MB/s) - ‘latest.zip’ saved [24962936/24962936]
Step 14: Extract the Downloaded zip file by using unzip command
[root@Linuxhelp ~]# unzip latest.zip
Archive: latest.zip
creating: wordpress/
inflating: wordpress/xmlrpc.php
inflating: wordpress/wp-blog-header.php
creating: wordpress/wp-content/themes/
creating: wordpress/wp-content/themes/twentytwentythree/
inflating: wordpress/wp-content/themes/twentytwentythree/theme.json
inflating: wordpress/wp-trackback.php
inflating: wordpress/wp-comments-post.php
Step 15: Move the wordpress directory under /var/www/html/ location by using the below command
[root@Linuxhelp ~]# mv wordpress /var/www/html/
Step 16: Set proper ownership and permissions for the WordPress directory by using the below command
[root@Linuxhelp ~]# chown -R apache:apache /var/www/html/wordpress
[root@Linuxhelp ~]# chmod -R 775 /var/www/html/wordpress
Step 17: Configure the SELinux context for the directory and its contents by using the below command
[root@Linuxhelp ~]# semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/wordpress(/.*)?"
[root@Linuxhelp ~]# restorecon -Rv /var/www/html/wordpress
Relabeled /var/www/html/wordpress from unconfined_u:object_r:admin_home_t:s0 to unconfined_u:object_r:httpd_sys_rw_content_t:s0
Relabeled /var/www/html/wordpress/xmlrpc.php from unconfined_u:object_r:admin_home_t:s0 to unconfined_u:object_r:httpd_sys_rw_content_t:s0
Relabeled /var/www/html/wordpress/wp-blog-header.php from unconfined_u:object_r:admin_home_t:s0 to unconfined_u:object_r:httpd_sys_rw_content_t:s0
Step 18: Rename the wp-config-sample.php to wp-config.php by using the below command
[root@Linuxhelp ~]# mv /var/www/html/wordpress/wp-config-sample.php
/var/www/html/wordpress/wp-config.php
Step 19: Edit the WordPress configuration file and define your database settings in below configuration file by using the below command
[root@Linuxhelp ~]# vi /var/www/html/wordpress/wp-config.php
Change the following lines
// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'mywordpress_db' );
/** Database username */
define( 'DB_USER', 'linuxhelp' );
/** Database password */
define( 'DB_PASSWORD', 'Pp123456' );
Step 20: Save and close the file, then restart the Apache service to apply the configuration changes by using the below command
[root@Linuxhelp ~]# systemctl restart httpd
Step 21: Access WordPress Installer Now, open your web browser and access the WordPress installer using the URL http://
Provide your site information and click on the Install WordPress button as shown in the below image
Click on the Log In button as shown in the below image
Step 22: Enter you Username and Password as shown in the below image
This is the Dashboard of WordPress CMS
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to install WordPress CMS on Rocky Linux 9.2. Your feedback is much welcome.