AlmaLinuxRHEL Based

How To Install WordPress on AlmaLinux 9

Install WordPress on AlmaLinux 9

In this tutorial, we will show you how to install WordPress on AlmaLinux 9. WordPress, the world’s most popular Content Management System (CMS), powers millions of websites globally. Its user-friendly interface, extensive customization options, and vast plugin ecosystem make it an ideal choice for building dynamic and feature-rich websites. To host WordPress, you need a reliable web server stack, and that’s where LAMP comes into play. LAMP, which stands for Linux, Apache, MariaDB (or MySQL), and PHP, is a powerful combination of open-source software that provides a robust foundation for hosting WordPress.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the WordPress on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux or RHEL-based.

Prerequisites

  • A server running one of the following operating systems: AlmaLinux 9.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
  • You’ll need root or sudo privileges to install WordPress and make system-wide changes. Make sure you have the necessary permissions before starting the installation process.

Install WordPress on AlmaLinux 9

Step 1. Update Your System.

To ensure a smooth installation process and maintain system stability, it’s crucial to update your AlmaLinux 9 system to the latest available packages. Open a terminal and execute the following command with root privileges:

sudo dnf clean all
sudo dnf update

This command will synchronize the package repositories and upgrade any outdated packages to their latest versions. The -y flag automatically answers “yes” to any prompts during the update process.

Step 2. Installing Apache Web Server.

Apache is a widely used web server software that efficiently handles HTTP requests and delivers web pages to clients. To install Apache on AlmaLinux 9, run the following command:

sudo dnf install httpd

Once the installation is complete, start the Apache service and enable it to run on the system boot using the following commands:

sudo systemctl start httpd
sudo systemctl enable httpd

To verify that Apache is running correctly, open a web browser and enter your server’s IP address or domain name. You should see the default Apache welcome page, indicating a successful installation.

Step 3. Installing MariaDB.

MariaDB is a popular open-source relational database management system that serves as a drop-in replacement for MySQL. WordPress uses MariaDB to store and manage its data efficiently. Install MariaDB by running the following command:

sudo dnf install mariadb-server

After the installation, start the MariaDB service and enable it to run on system boot:

sudo systemctl start mariadb
sudo systemctl enable mariadb

To secure your MariaDB installation, run the mysql_secure_installation script:

sudo mysql_secure_installation

This script prompts you to set a root password, remove anonymous users, disable remote root login, and remove the test database. Follow the on-screen instructions and answer “Y” to all the questions for enhanced security.

Next, log in to the MariaDB shell using the root password you set earlier:

sudo mysql -u root -p

Create a new database and user for WordPress by running the following commands within the MariaDB shell:

CREATE DATABASE wordpress;
GRANT ALL ON wordpress.* TO 'wpuser'@'localhost' IDENTIFIED BY 'your_strong_password';
FLUSH PRIVILEGES;
EXIT;

Replace ‘your_strong_password‘ with a secure password of your choice. This step creates a dedicated database and user for WordPress, ensuring better security and isolation from other applications.

Step 4. Installing PHP 8.3.

PHP is a server-side scripting language that powers WordPress and enables dynamic content generation. AlmaLinux 9’s default repositories do not include PHP 8.3, so you need to enable the EPEL (Extra Packages for Enterprise Linux) and Remi repositories. Run the following commands to enable the repositories:

sudo dnf install epel-release
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm

Next, install PHP 8.3 and the necessary extensions for WordPress using the following command:

sudo dnf install php83 php83-php php83-php-{cli,common,curl,gd,mbstring,mysqlnd,xml}

To optimize PHP performance, modify the php.ini configuration file:

sudo nano /etc/php.ini

Locate the following settings and modify them as shown below:

memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
date.timezone = "your_timezone"

Replace “your_timezone” with your actual timezone (e.g., “America/New_York”). Save the changes and exit the text editor.

Restart the Apache service to apply the PHP configuration changes:

sudo systemctl restart httpd

Step 5. Downloading and Configuring WordPress

With the LAMP stack configured, you can now download and set up WordPress. Visit the official WordPress website and download the latest version of WordPress:

wget https://wordpress.org/latest.zip

Extract the downloaded archive to the Apache root directory (/var/www/html/) using the following command:

sudo unzip wordpress-*.zip -d /var/www/html/

Create a new directory for WordPress and move the extracted files into it:

sudo mkdir -p /var/www/html/wordpress
sudo mv /var/www/html/wordpress/* /var/www/html/wordpress/

Next, create a new configuration file for WordPress by copying the sample configuration file:

sudo cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php

Open the wp-config.php file in a text editor:

sudo nano /var/www/html/wordpress/wp-config.php

Locate the following lines and replace the placeholder values with your actual database details:

define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', 'your_strong_password' );

Step 6. Configure Firewall.

Open the necessary ports for web traffic by running the following commands:

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

These commands allow HTTP (port 80) and HTTPS (port 443) traffic through the firewall and ensure that the changes persist across system reboots.

Step 7. Setting Up Let’s Encrypt HTTPS for WordPress.

Certbot is the official client for obtaining and installing Let’s Encrypt SSL certificates. Install it using the package manager for your Linux distribution:

sudo dnf install certbot python3-certbot-apache

Next, run Certbot with the Apache plugin to obtain and install the SSL certificate:

sudo certbot --apache -d your_domain.com -d www.your_domain.com

Follow the prompts to provide an email address and agree to the Let’s Encrypt terms of service.

Step 8. Completing WordPress Installation

With the WordPress files in place and the configuration set up, you can now complete the installation through a web browser.

Open your web browser and navigate to https://your_server_ip/wordpress or https://your_domain.com/wordpress. You will be greeted with the WordPress installation wizard.

Install WordPress on AlmaLinux 9

Congratulations! You have successfully installed WordPress. Thanks for using this tutorial for installing the WordPress on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official WordPress website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button