How to Install WordPress on Alma Linux 10 with a LEMP Stack

How to Install WordPress on Alma Linux 10 with a LEMP Stack

Although there are many control panels available today for 1-click WordPress installation, many people still prefer to install WordPress manually using a LAMP or LEMP stack. If you are looking for how to install WordPress on Alma Linux 10 with a LEMP stack without using a control panel, you can follow the tutorial on this page.

If you are using a different version of Alma Linux, there may be some things or paths that you need to adjust yourself. Additionally, for this tutorial, the domain has already been pointed to the server with the domain name tutorial.wpgan.com, so you can adjust it to your own domain name later.

How to Install WordPress on Alma Linux 10 with a LEMP Stack

Before starting, make sure you have root access to the VPS you will be using. If you do not have a VPS yet, you can try the service at Vultr from [This Page] to get a $300 trial credit when you link a credit card or PayPal.

If you already have a VPS with the Alma Linux 10 OS, you can proceed to the first step

1. Update System & Install Basic Tools

Make sure to update the system before performing the installation, and also install the basic tools that you will need for the WordPress installation process

dnf -y updatednf -y install epel-release dnf-plugins-core curl ca-certificates gnupg2 tar unzip
Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 1

2. Setup Firewall and Set SELinux

For security, you can enable the firewall, or if you are using a service like Google Console, there is usually a firewall already configured in the dashboard, so this option is optional

systemctl enable firewalldsystemctl start firewalld
firewall-cmd --permanent --add-service=httpfirewall-cmd --permanent --add-service=httpsfirewall-cmd --permanent --add-port=22/tcp ## untuk akses SSH, jika menggunakan port lain, pastikan allow juga port customnyafirewall-cmd --reload

Also, make sure to set SELinux so it does not block the web server (required)

setsebool -P httpd_can_network_connect 1setsebool -P httpd_can_network_connect_db 1
Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 2

3. Add Nginx, PHP, and MariaDB Repos

Since we are using LEMP here, it means we need to install Nginx, PHP, and MariaDB. However, before installing, you need to add the upstream repo so you can install the latest versions of Nginx, PHP 8.5, and MariaDB 11.8.

# Enable CRB repodnf config-manager --set-enabled crb
# Install Remi repo (untuk PHP 8.5)dnf -y install https://rpms.remirepo.net/enterprise/remi-release-10.rpm
# Tambah official Nginx stable repocat > /etc/yum.repos.d/nginx.repo << 'EOF'[nginx-stable]name=nginx stable repobaseurl=https://nginx.org/packages/rhel/$releasever/$basearch/gpgcheck=1enabled=1gpgkey=https://nginx.org/keys/nginx_signing.keymodule_hotfixes=trueEOF
# Tambah MariaDB 11.8 repocurl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version=mariadb-11.8
Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 3

4. Install Nginx, PHP 8.5, and MariaDB

Once you add the upstream repo, you can then install Nginx, PHP, and MariaDB

# Install Nginxdnf -y install nginx
# Enable PHP 8.5 dari Remidnf module reset php -ydnf -y install php85 php85-php-fpm php85-php-mysqlnd php85-php-gd \  php85-php-xml php85-php-mbstring php85-php-curl php85-php-zip \  php85-php-intl php85-php-json php85-php-opcache
# Install MariaDBdnf -y install mariadb-server mariadb

Make sure to start all services (Nginx, PHP, MariaDB) after the installation is complete

systemctl enable --now nginxsystemctl enable --now php85-php-fpmsystemctl enable --now mariadb
Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 4

To double-check, you can also verify the installed versions

nginx -vphp85 -vmariadb --version

5. Create WordPress Database

Before creating the database, make sure you secure MariaDB first

mariadb-secure-installation

Just complete the secure install prompts such as setting the root password, removing anonymous users, disallowing remote root login, and removing the test database. Answer Y to all of them to apply everything.

Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 5.1

If you have already secured MariaDB or the database, you can then access the database

mariadb -u root -p

Once you have entered MariaDB, you can create a new database

CREATE DATABASE wpgan_wp_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE USER 'wpgan_wp_user'@'localhost' IDENTIFIED BY 'input_password_kamu_disini';GRANT ALL PRIVILEGES ON wpgan_wp_db.* TO 'wpgan_wp_user'@'localhost';FLUSH PRIVILEGES;EXIT;

Make sure to change input_your_password_here with the database password you will be using.

Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 5.2

6. Download and Extract WordPress

First, download the latest WordPress to the /tmp folder and extract the files

cd /tmpcurl -O https://wordpress.org/latest.tar.gztar -xzf latest.tar.gzcp wordpress/wp-config-sample.php wordpress/wp-config.php

Move the extracted files to your website installation folder

mkdir -p /var/www/html/tutorial.wpgan.comcp -r wordpress/* /var/www/html/tutorial.wpgan.com/

Also, update the permissions on your website folder

chown -R nginx:nginx /var/www/html/tutorial.wpgan.comchmod -R 755 /var/www/html/tutorial.wpgan.com
Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 6

7. Configure WordPress Database

So that the database is connected and you can perform the WordPress installation, you need to set up the database and WordPress salts first

nano /var/www/html/tutorial.wpgan.com/wp-config.php

Change the DB_NAME, DB_USER, and DB_PASSWORD sections according to the database you created in step number 5.

Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 7

8. Configure Nginx Server

So that the website can be accessed, you need to configure the Nginx virtual host server first

nano /etc/nginx/conf.d/wpgan-wp.conf

Fill the file with this code

server {    listen 80;    server_name tutorial.wpgan.com www.tutorial.wpgan.com;    root /var/www/html/tutorial.wpgan.com;    index index.php index.html index.htm;
    location / {        try_files $uri $uri/ /index.php?$args;    }
    location ~ \.php$ {        fastcgi_pass unix:/var/opt/remi/php85/run/php-fpm/www.sock;        fastcgi_index index.php;        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;        include fastcgi_params;    }
    location ~ /\.ht {        deny all;    }
    client_max_body_size 64M;}

adjust the server_name and root according to the domain name and document root of the WordPress files you created.

Save the changes by clicking CTRL + X > Y > Enter.

Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 8

Note: the socket path for PHP 8.5 from Remi is at /var/opt/remi/php85/run/php-fpm/www.sock. Check it first if you are unsure:

find /var -name "www.sock" 2>/dev/null

Also, do not forget to test the Nginx configuration and reload the Nginx service

nginx -tsystemctl reload nginx

9. Update ACL Users

By default, the ACL Users in PHP FPM 8.5 are installed using Apache, but because we are using Nginx, it will automatically result in a 502 error when the website is accessed. Update the ACL Users first

nano /etc/opt/remi/php85/php-fpm.d/www.conf

Press CTRL + F to search, then look for listen.acl_users. Change the value listen.acl_users = apache to listen.acl_users = nginx, then save

Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 9

10. Complete WordPress Configuration

Now you can access your website's IP address or domain name to perform the WordPress configuration, such as entering the website name, setting the admin username, email, and more.

Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 10.1

Complete the process and your WordPress is ready to be used.

Cara Install WordPress di Alma Linux 10 dengan LEMP Stack - WPGan.com - 10.2

That is the quick step to install WordPress on Alma Linux 10 with a LEMP Stack that you can try.

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...