Cloud Service >> Knowledgebase >> WordPress >> How To Install WordPress On Redhat Linux 9?
submit query

Cut Hosting Costs! Submit Query Today!

How To Install WordPress On Redhat Linux 9?

WordPress is among the most popular content management systems for websites today. It is a handy tool with many settings for creating a blog or website for a particular company.

This tutorial is for Red Hat Linux 9 users who want to install WordPress step by step. Beginning with the server installation, your website will run in a stable cloud hosting environment.

Prerequisites

Before beginning the installation process of the Red Hat Linux 9 server, ensure that it fulfills the following conditions.

1. Root Access

You need root access to your server to install and set up the required software.

2. LAMP Stack

WordPress requires a stack of Linux, Apache, MySQL, and PHP (LAMP) to run properly. We will discuss it in the next section if it is not installed.

3. Domain Name

It is recommended that you have a domain name ready. However, WordPress can also be accessed using your server's IP address.

1.Set Up the LAMP Stack

Update Your Server

First, update your server to ensure all packages are up to date:

 

sudo dnf update -y

Install Apache

Apache is the web server most frequently used with WordPress. Use the following command provided to set it up:

sudo dnf install httpd -y

Start Apache and enable it to start on boot:

sudo systemctl start httpd

sudo systemctl enable httpd

Install MySQL

WordPress requires a database to store its content. Set up MySQL (or MariaDB) by running the below command:

sudo dnf install mariadb-server -y

Start the MySQL service and enable it to start on boot:

sudo systemctl start mariadb

sudo systemctl enable mariadb

Run the MySQL secure installation script to secure your database server:

sudo mysql_secure_installation

Adhere to the instructions on the screen to establish a root password and safeguard your installation.

Install PHP

WordPress is constructed using PHP as its scripting language. Install PHP along with necessary extensions:

sudo dnf install php php-mysqlnd php-fpm php-json php-xml php-mbstring -y

Restart Apache to load the PHP module:

sudo systemctl restart httpd

2. Create a MySQL Database for WordPress

Afterwards, you must establish a MySQL database and user specifically for WordPress.

- Log in to MySQL as the root user:

  sudo mysql -u root -p

- Create a database for WordPress:

 

  CREATE DATABASE wordpress;

- Set up a MySQL user for WordPress. Provide full privileges to the `wordpress` database.

 

   CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';

   GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';

   FLUSH PRIVILEGES;

  EXIT;

Replace `'password'` with a secure password.

3. Download and Configure WordPress

- Download WordPress

Navigate to the Apache web directory and download the latest version of WordPress:

cd /var/www/html

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

Extract the downloaded archive:

sudo tar -xzvf latest.tar.gz

- Configure WordPress

Navigate to the WordPress directory and copy the sample configuration file:

cd wordpress

sudo cp wp-config-sample.php wp-config.php

Edit the configuration file to add your database details:

sudo nano wp-config.php

Update the following lines with your database information:

define('DB_NAME', 'wordpress');

define('DB_USER', 'wordpressuser');

define('DB_PASSWORD', 'password');

define('DB_HOST', 'localhost')

Save and close the file.

Set Correct Permissions

Set the correct ownership and permissions for the WordPress files:

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

sudo chmod -R 755 /var/www/html/wordpress

4. Configure Apache for WordPress

Generate a specific Apache virtual host configuration file for your website:

sudo nano /etc/httpd/conf.d/wordpress.conf

Include the below content,

    ServerName your_domain.com

   DocumentRoot /var/www/html/wordpress

    

        AllowOverride All

   

    ErrorLog /var/log/httpd/wordpress_error.log

    CustomLog /var/log/httpd/wordpress_access.log combined



Save and close the file. Restart Apache to apply the changes:

sudo systemctl restart httpd

5. Complete WordPress Installation via Web Browser

- Launch your internet browser and go to `http://your_domain.com` (or the IP address of your server).

- The WordPress installation page will greet you. Select your language and click "Continue."

- Provide the site title, username, password, and email details before selecting "Install WordPress."

- After the installation, you can navigate to your WordPress backend. You only have to sign in using the username and password that you create.

6.Secure Your WordPress Installation

Security is vital, particularly when running your WordPress site on a cloud server. Here are some basic steps to secure your installation:

- Install SSL/TLS Certificate

Utilize Let's Encrypt to acquire a no-cost SSL certificate for your website, guaranteeing that all information is encrypted.

   sudo dnf install certbot python3-certbot-apache -y

  sudo certbot --apache

- Keep Software Updated

Frequently update WordPress, plugins, and your server's software to guard against vulnerabilities.

- Configure Firewall

Utilize `firewalld` to set up the firewall on your server. It permits only essential traffic.

   sudo firewall-cmd --permanent --add-service=http

   sudo firewall-cmd --permanent --add-service=https

  sudo firewall-cmd --reload

To Sum it Up!

By following these instructions, you will have a functional WordPress setup on your Red Hat Linux 9 server. Using a cloud server to host WordPress provides versatility, scalability, and firm performance, making it an excellent option for all websites. Ensure that the security and timeliness of your WordPress installation and server environment are maintained to guarantee your site's optimal performance and protection.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!