Linux, Web Hosting, and Everything Else in Between
Linux, Web Hosting, and Everything Else in Between
Best WordPress Hosting

How to Install WordPress on AlmaLinux

In this tutorial, we’ll show you how to install WordPress on AlmaLinux with a LEMP stack.

AlmaLinux is a relatively new Linux distro – an alternative to the old CentOS. It’s an RHEL clone, a downstream build, run by the community, and it’s free. You can easily migrate from CentOS to AlmaLinux using their tools. You can already get an AlmaLinux VPS at some hosting providers like Linode and Vultr.

Check our tutorial on how to install WordPress on Ubuntu or how to install WordPress on CentOS with Centmin Mod

Now, onto the tutorial.


For this tutorial, you’ll need:

  • An AlmaLinux server with root access. You can get one from Linode and Vultr.
  • A LEMP stack (Linux, Nginx, MariaDB, PHP) – we’ll show you how to install the stack below. If you already have a LEMP stack installed, just skip the installation steps.
  • An SSH client so you can connect to the server
  • WordPress doesn’t have any specific requirements, but we do recommend a VPS with at least 1GB RAM. You can use a smaller VPS for smaller sites though

Step 1: Get an AlmaLinux VPS

The first step is to get a VPS with AlmaLinux. As of writing, not many hosting providers offer an AlmaLinux server image by default, but you can install a custom ISO on most hosting providers. Linode and Vultr do have an AlmaLinux image so you can set up an AlmaLinux VPS with a few clicks.

AlmaLinux on Linode
AlmaLinux on Linode

For this tutorial, we’ll be using Linode and AlmaLinux 8, but any other hosting provider or distro version will work fine as well.

Step 2: Log in to the server and update it

Log in as root to your server via SSH, and then, run the following commands to update your system:

yum update

Step 3: Install Nginx

To install Nginx on AlmaLinux, run the following command:

yum install nginx

Next, enable Nginx to start on boot:

systemctl enable nginx

and then, start the Nginx service:

systemctl start nginx

Step 4: Install MariaDB

To be able to install MariaDB on AlmaLinux, you’ll first need to update the repos.

First, create a file:

nano /etc/yum.repos.d/mariadb.repo

and add the following:

name = MariaDB
baseurl =

As of writing, the latest stable MariaDB release is 10.6. If you’re running a different setup, go here to get different content for this file.

After you save and close the file, update the yum repos again:

yum update

And finally, install MariaDB:

yum install mariadb-server

Next, enable the MariaDB to start on boot and start the service:

systemctl enable mariadb
systemctl start mariadb

Run the following script to secure your MariaDB:


Step 5: Create a database

Now, log in to MariaDB with the root user:

mysql -u root -p

Create a database:


Create a user and password (change the password):

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

Grant and flush the privileges:

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

And exit out of MariaDB:


Step 6: Install and configure PHP

As of writing, the PHP version that’s included in the AlmaLinux repos is 7.2, which is not supported by WordPress. Instead, in this tutorial, we’ll show you how to install PHP 8.1, the currently latest PHP version.

We’ll need to use the Remi repositories to install PHP 8.1. So, first, run the following command:

yum install epel-release

next, add the remi repo:

yum install

and update your repos again:

yum update

Next, enable the remi PHP 8.1 module:

yum module enable php:remi-8.1

And finally, install PHP 8.1 and a few needed extensions with the following command:

yum install php php-mysqlnd php-fpm php-curl php-soap php-intl php-gd php-common php-mbstring php-xml php-json php-zip php-xmlrpc

Next. enable and start the PHP-FPM service:

systemctl enable php-fpm
systemctl start php-fpm

Now, edit the following file:

nano /etc/php-fpm.d/www.conf

And change “user = apache” and “group = “apache” to “user = nginx” and “group = nginx”. Find those lines and update them. The updated lines should look like this:

; RPM: apache user chosen to provide access to the same directories as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

And uncomment (by removing the ; on the start of the line) and update the following lines:


listen.owner = nginx = nginx
listen.mode = 0660


listen.acl_users = nginx

Tip: if you’re using Nano, hit CTRL + W to search the file.

Finally, restart php-fpm and nginx:

systemctl restart php-fpm
systemctl restart nginx

Step 7: Configure Nginx

We need to create a server block for our new WP site. Replace all instances of “” with your domain name.

First, create a directory:

mkdir -p /var/www/html/

And update the permissions:

chown -R $USER:$USER /var/www/html/

Next, update the nginx.conf file:

nano /etc/nginx/nginx.conf

and replace the root directory in the server block. The file should look like this after you update it:

server_name _;
root /var/www/html/;

Next, create an nginx conf file for your website:

nano /etc/nginx/conf.d/

And add the following:

    server {
    listen         80;
    listen         [::]:80;
    root           /var/www/html/;
    index          index.html;

    location / {
      index index.php index.html index.htm;
      try_files $uri $uri/ =404;
    location ~* \.php$ {
      fastcgi_pass unix:/run/php-fpm/www.sock;
      include         fastcgi_params;
      fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
      fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;

Next, restart nginx:

systemctl restart nginx

and test the configuration with the following command:

nginx -t

Step 7: Download WordPress

First, download the latest version of WordPress:

curl -L -O

(note: you’re currently in the root directory, you can create a new temp directory to do this in if you want to, but we’ll remove everything later on anyway)

And unpack it:

tar -xvf latest.tar.gz

Then, move the content of the unpacked archive to your root directory:

mv wordpress/* /var/www/html/

And remove the file/directory:

rm latest.tar.gz
rm -r wordpress/

Change the ownership of the directory:

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

Step 8: Configure your firewall

By default, FirewallD is enabled and working on AlmaLinux. You need to allow connections for ports 80 and 443 for the site to work:

firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --zone=public --add-service=https --permanent
firewall-cmd --reload

Step 9: Finish the installation

The final step is to finish the WP installation by visiting your domain name and entering the database info from step 5. That’s it!

final wordperss installation

If you still don’t want to install WordPress yourself or if you’re stuck somewhere, you can use a managed VPS provider like SolaDrive – they will install WordPress for you.

Leave a comment

Your email address will not be published. Required fields are marked *