What is WordPress?

WordPress is a powerful and user-friendly content management system (CMS) that allows you to build and manage websites of all types—from simple blogs to complex business portals and online stores. It is open-source, highly extensible with themes and plugins, and supports everything from blogging to e-commerce via tools like WooCommerce.


Why Use AlmaLinux 9 for Hosting WordPress?

AlmaLinux 9 is a Red Hat Enterprise Linux (RHEL)-compatible operating system developed as a stable, free replacement for CentOS. It is ideal for production servers where long-term support, security, and predictable updates are essential.

Key Benefits of AlmaLinux 9:

  • 10-year support lifecycle (until 2032)
  • Binary-compatible with RHEL 9
  • Ideal for enterprise-grade WordPress deployments
  • SELinux-enabled for security
  • Compatible with tools like dnf, systemd, and firewalld

What is the LAMP Stack?

LAMP is an acronym for:

  • Linux – Operating system (AlmaLinux 9)
  • Apache – Web server
  • MariaDB – Relational database
  • PHP 8.3 – Server-side scripting language

This stack is well-known for its reliability, scalability, and widespread community support.


Why Use PHP 8.3 on AlmaLinux 9?

AlmaLinux 9 comes with older PHP versions by default (e.g., PHP 8.0), so PHP 8.3 must be installed from the Remi repository, which is actively maintained and offers the latest PHP builds.

Advantages of PHP 8.3:

  • Faster execution and lower memory usage
  • Enhanced syntax and strict typing
  • JIT (Just-In-Time) compilation support
  • Improved plugin and theme performance

MariaDB on AlmaLinux 9

MariaDB 10.5+ is included in the base repository and is fully compatible with WordPress. It stores all website content, user data, metadata, settings, and plugin information.

Recommended Configurations:

  • Use InnoDB for all tables
  • Enable slow query logging for optimization
  • Secure with mysql_secure_installation
  • Restrict remote access unless needed

Apache on AlmaLinux 9

Apache 2.4 is the default web server and is widely used for WordPress deployments.

Key Apache Features for WordPress:

  • .htaccess support for permalinks and redirects
  • Easy SSL configuration with mod_ssl
  • Compatible with mod_rewrite, mod_deflate, and http2
  • Supports virtual hosts for hosting multiple WordPress sites

Typical Use Cases

  • Small business websites and blogs
  • Corporate portals with custom themes
  • News and magazine-style sites
  • E-commerce platforms with WooCommerce
  • University and institutional websites

Security Best Practices

  • Use SELinux in enforcing mode
  • Set proper file permissions (644 for files, 755 for directories)
  • Restrict access to wp-admin or secure with HTTP Auth
  • Disable XML-RPC if unused
  • Install Fail2Ban to prevent brute-force logins
  • Use Certbot with Let’s Encrypt for free HTTPS

Performance Optimization Tips

  • Enable OPcache with PHP 8.3
  • Use caching plugins like WP Super Cache or W3 Total Cache
  • Enable GZIP compression and browser caching in Apache
  • Optimize the database with plugins like WP-Optimize
  • Use a CDN for faster delivery of images and static assets

Advantages of WordPress on AlmaLinux 9 LAMP Stack

ComponentBenefit
AlmaLinux 9Long-term supported, stable RHEL-compatible OS
ApacheIndustry-standard HTTP server with strong plugin support
MariaDBLightweight, open-source, and fully compatible with WordPress
PHP 8.3Fast, modern, and required by many newer themes/plugins

Running WordPress on AlmaLinux 9 with Apache, MariaDB, and PHP 8.3 delivers a secure, stable, and enterprise-ready platform for website hosting. By combining the robustness of AlmaLinux with the speed of PHP 8.3 and the flexibility of WordPress, you can deploy everything from personal blogs to mission-critical web applications with confidence.


Step 1: Set Up a Server Instance on Shape.Host

Log into your Shape.Host account.

Click “Create” and choose “Instance”.

Shape.host Resources dashboard with Create > Instance highlighted.

Select a server location close to your target audience.

Shape.host instance form with the data center location selector highlighted.

Pick AlmaLinux 9 (64-bit) as the operating system.

Choose a plan with at least 2 vCPU, 4 GB RAM, and 20 GB SSD.

Shape.host instance form with the operating system image selector highlighted.

Click “Create Instance” and wait for deployment.

Shape.host instance form with the Create Instance button highlighted.

Copy your new instance’s IP address for SSH access.

Shape.host Resources dashboard with the server IP address highlighted.

Step 2: Connect to Your AlmaLinux 9 Server

On Linux/macOS:

ssh root@your_server_ip

On Windows:

  • Use PuTTY, enter the IP, connect via port 22, and log in as root.

Step 3: Install WordPress with Apache, MariaDB, PHP 8.3

1. Update the System

dnf update

🔹 Updates system packages to the latest versions.

Terminal showing DNF/YUM package management commands and output.

2. Install Apache Web Server

dnf install httpd

🔹 Installs the Apache HTTP server.

Terminal showing DNF/YUM package management commands and output.
systemctl enable httpd

🔹 Ensures Apache starts at boot.

systemctl start httpd

🔹 Starts the Apache service now.

Terminal showing systemd service management commands or output.

3. Install MariaDB Server

dnf install mariadb-server

🔹 Installs the MariaDB server package.

Terminal showing DNF/YUM package management commands and output.
systemctl enable mariadb

🔹 Enables MariaDB to start on boot.

systemctl start mariadb

🔹 Starts the MariaDB service.

Terminal showing systemd service management commands or output.

4. Secure the MariaDB Server

mysql_secure_installation

🔹 Set root password, remove anonymous users, disable remote root login, and remove test DB.

Terminal showing mysql commands or output during Secure the MariaDB Server.

5. Create WordPress Database and User

mysql -u root -p

🔹 Logs into MariaDB with root credentials.

Inside the MariaDB shell:

CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

🔹 Creates a dedicated database and user for WordPress.

Terminal showing SQL database and user configuration commands.

6. Add Remi Repository for PHP 8.3

dnf install epel-release

🔹 Installs the EPEL repository.

Terminal showing DNF/YUM package management commands and output.
dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm

🔹 Adds Remi’s PHP repository for RHEL 9-compatible systems.

Terminal showing DNF/YUM package management commands and output.
dnf module reset php

🔹 Resets the current PHP module to allow selecting a new version.

Terminal showing DNF/YUM package management commands and output.
dnf module enable php:remi-8.3

🔹 Enables PHP 8.3 from Remi repo.

Terminal showing DNF/YUM package management commands and output.

7. Install PHP 8.3 and Required Extensions

dnf install php php-mysqlnd php-fpm php-curl php-dom php-exif php-fileinfo php-gd php-intl php-mbstring php-opcache php-pdo php-soap php-xml php-zip

🔹 Installs PHP 8.3 with all necessary extensions for WordPress.

Terminal showing DNF/YUM package management commands and output.
systemctl restart httpd

🔹 Reloads Apache with PHP enabled.


8. Download and Configure WordPress

cd /var/www/html

🔹 Navigate to Apache’s root directory.

rm -f index.html

🔹 Remove the default index file.

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

🔹 Download the latest version of WordPress.

Terminal showing systemd service management commands or output.
tar -xvzf latest.tar.gz

🔹 Extract the archive.

mv wordpress/* .

🔹 Move WordPress files to the current directory.

rm -rf wordpress latest.tar.gz

🔹 Clean up unnecessary files.


9. Set Permissions

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

🔹 Assign ownership to Apache.

find /var/www/html -type d -exec chmod 755 {} \;

🔹 Set correct permissions for directories.

find /var/www/html -type f -exec chmod 644 {} \;

🔹 Set correct permissions for files.

Terminal showing file and directory setup commands.

10. Configure WordPress Database Settings

cp wp-config-sample.php wp-config.php
nano wp-config.php

🔹 Edit the database settings:

define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', 'strongpassword' );
define( 'DB_HOST', 'localhost' );
Terminal showing application configuration settings.

11. Create Virtual Host for WordPress

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

Paste this config:

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/html

    <Directory /var/www/html>
        AllowOverride All
    </Directory>

    ErrorLog /var/log/httpd/wordpress_error.log
    CustomLog /var/log/httpd/wordpress_access.log combined
</VirtualHost>
Terminal showing web server configuration text.

12. Allow .htaccess Overrides

nano /etc/httpd/conf/httpd.conf

Locate:

<Directory "/var/www">
    AllowOverride None

Change it to:

<Directory "/var/www">
    AllowOverride All
Apache directory configuration excerpt with AllowOverride settings.

13. Restart Apache

systemctl restart httpd

🔹 Apply the virtual host and override changes.

Terminal showing systemd service management commands or output.

14. Enable HTTPS with Certbot

dnf install certbot python3-certbot-apache

🔹 Installs Certbot for managing SSL.

Terminal showing DNF/YUM package management commands and output.
firewall-cmd --permanent --add-service=http

🔹 Opens port 80.

systemctl unmask firewalld
systemctl enable firewalld
systemctl start firewalld

🔹 Unmasks, enables, and starts the firewall service.

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
Terminal showing systemd service management commands or output.

🔹 Allows HTTP and HTTPS access through the firewall.

certbot --apache -d almalinux-tutorials.shape.host

🔹 Issues a free SSL certificate for your domain.

Terminal showing an Apache configuration test.
certbot renew --dry-run

🔹 Tests automatic SSL renewal.

Terminal showing Certbot certificate commands and messages.

Step 4: Finish Setup in Browser

Visit:

https://your-domain.com

You’ll see the WordPress installation screen. Complete the setup by entering your site title, admin user, and password.

WordPress setup interface.

Create an admin account and click the Install WordPress button.

WordPress installer form for site title and administrator account details.
WordPress setup interface.
WordPress sign-in form.
WordPress dashboard.

You’ve installed WordPress on AlmaLinux 9 with a full LAMP stack, PHP 8.3, and Let’s Encrypt SSL. Your site is now ready for production use, development, or client deployment.

For high-performance, secure, and scalable hosting, deploy your WordPress site on Shape.Host Linux SSD VPS — designed for modern web infrastructure.