How to Install WordPress with LAMP on Rocky Linux 9.2

WordPress is a commonly used PHP-based CMS (Content Management System). For small businesses, personal blogs & websites, WordPress can be a good fit.  In this article, we are going to learn how to install WordPress on Rocky Linux 9.2. So, let’s get started.

Pre-requisites :


  • A system with Rocky Linux 9.2 installed and running.

  • root access to the system.

  • LAMP Stack installed and running, for this, you can refer to one of our guides on installing the LAMP Stack (Apache, MariaDB, and PHP.

Once you're all set, we'll proceed with WordPress installation and configuration.

Install Wget & Developer Tools


yum groupinstall "Development tools"

yum install wget

Download WordPress


First, navigate to the/var/www directory as follows:

cd /var/www

Now, download the latest WordPress archive from the official website of WordPress with the following command:

wget https://wordpress.org/latest.tar.gz

Check for files with the following command.

ls

Now, extract the WordPress archive file latest.tar.gz with the following command:

tar xvzf latest.tar.gz

Once the WordPress archive file latest.tar.gz is extracted, a new directory wordpress/ should be created in the folder. Now, you can remove the latest.tar.gz file as follows:

rm -v latest.tar.gz

Setting up FilePermission & Ownership


Now, change the owner and group of the wordpress/ directory and its contents to apache as follows:

chown -Rf apache:apache ./wordpress/

Now, change the permission or the wordpress/ directory and its content to 775 as follows:

chmod -Rf 775 ./wordpress/

Use this command only if you have enabled SELinux, Otherwise don't.

semanage fcontext -a -t httpd_sys_rw_content_t \ "/var/www/wordpress(/.*)?"

For the SELinux changes to take effect.

restorecon -Rv /var/www/wordpress

Configuring Apache vHost


Now, create a new Apache configuration file wordpress.conf for WordPress with the following command:

vi /etc/httpd/conf.d/wordpress.conf

Now, press i to go to INSERT mode and type in the following lines of codes in the wordpress.conf file.

<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot /var/www/wordpress
<Directory "/var/www/wordpress">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/httpd/wordpress_error.log
CustomLog /var/log/httpd/wordpress_access.log common
</VirtualHost>

Finally, the wordpress.conf will look like the image shown below.

Now, press the Esc key, and type in :wq! and press the Enter key to save and exit the file.

Now, restart & check the Apache httpd service with the following commands:

systemctl restart httpd

systemctl restart httpd

Configuring Database


Now create a Database, User & Password for WordPress:

mysql -u root

CREATE DATABASE wordpress;

GRANT ALL ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'secret';

FLUSH PRIVILEGES;

quit

Configuring WordPress


Now open the IP address from your browser, this will redirect you to the wp-admin part of configuring the final parts of WordPress installation.

http://IP_address

Replace the IP_address with the actual IP of the server.

Input the Database details which was configured earlier.

 

 

 

 

Solving Critical Issues in Wordpress After Installation on Rocky Linux 9.2

 

 

Your site is unable to reach WordPress.org at 198.143.164.251, and returned the error: cURL error 7:

sudo setsebool -P httpd_can_network_connect true

 

define('FS_METHOD','direct');


Background updates are not working as expected Security

Background updates ensure that WordPress can auto-update if a security update is released for the version you are currently using.

    Passed No version control systems were detected.
    Error Your installation of WordPress prompts for FTP credentials to perform updates. (Your site is performing updates over FTP due to file ownership. Talk to your hosting company.)
هل كانت المقالة مفيدة ؟

مقالات مشابهة

What is a Dedicated Server?

A dedicated server provides dedicated internet hosting on a physical server that is attached to a...

What is server hosting?

Server hosting is a huge benefit for any size business or organization. Server hosting is the...

Do I need a Dedicated Server for my website?

A dedicated server is a resource-rich machine that is typically used by organizations with heavy...

Are your Dedicated Servers managed?

We offer both cPanel Managed Dedicated Servers and Unmanaged Dedicated Servers, often referred to...

How to Install cPanel/WHM on CentOS 7

Installation Requirements A clean fresh minimal installation of CentOS 7 server. Minimum of 1...

Powered by WHMCompleteSolution