Learn how to install a LAMP stack on AlmaLinux 10 with Apache, MariaDB, and PHP. Follow this step by step guide to prepare your server for WordPress, Laravel, and other PHP applications.
AlmaLinux has become one of the most popular operating systems for web hosting, cloud deployments, and enterprise workloads. As a community driven, RHEL compatible distribution, it offers excellent stability, predictable updates, and long term support, making it a strong choice for production servers.
If you're planning to host a WordPress website, Laravel application, business portal, or a custom PHP project, you'll need a reliable web stack to serve content, process requests, and store data. That's where a LAMP stack comes in.
LAMP stands for Linux, Apache, MariaDB, and PHP. Together, these components provide everything needed to run dynamic websites and modern PHP applications.
In this tutorial, we'll install Apache, MariaDB, and PHP on AlmaLinux 10, verify that each service is working correctly, and prepare the server for hosting web applications.
Prerequisites
Before starting, make sure you have:
- An AlmaLinux 10 dedicated server.
- Root access or a sudo enabled user
- A stable internet connection
Connect to your server via SSH:
ssh username@server-ip
Replace username and server-ip with your actual server details.
Step 1: Update System Packages
Before installing new software, update the system packages to ensure everything is current.
Run:
sudo dnf update -y
This downloads and installs the latest package updates available for AlmaLinux 10.
Step 2: Install Apache Web Server
Apache remains one of the most trusted web servers for hosting websites and applications.
Install Apache:
sudo dnf install httpd -y
Enable and start the service:
sudo systemctl enable --now httpd
Verify the service status:
sudo systemctl status httpd
You should see that the service is active and running.
Step 3: Configure the Firewall
AlmaLinux includes firewalld by default. You'll need to allow web traffic through the firewall.
Allow HTTP traffic:
sudo firewall-cmd --permanent --add-service=http
Allow HTTPS traffic:
sudo firewall-cmd --permanent --add-service=https
Reload the firewall:
sudo firewall-cmd --reload
Verify active rules:
sudo firewall-cmd --list-services
You should see both http and https listed.
Step 4: Verify Apache Installation
Open a browser and visit:
http://your-server-ip
If Apache is working correctly, you'll see the default AlmaLinux Apache test page.
Step 5: Install MariaDB
MariaDB serves as the database engine for storing website and application data.
Install MariaDB Server:
sudo dnf install mariadb-server -y
Enable and start the database service:
sudo systemctl enable --now mariadb
Check the service status:
sudo systemctl status mariadb
Step 6: Install PHP
PHP powers popular applications such as WordPress, Laravel, Magento, Drupal, and many others.
Install PHP and commonly used extensions:
sudo dnf install php php-cli php-common php-mysqlnd php-curl php-gd php-mbstring php-xml php-zip php-intl php-bcmath -y
Verify the installed PHP version:
php -v
Example output:
PHP 8.3.29 (cli) (built: Dec 16 2025 14:32:42) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.3.29, Copyright (c) Zend Technologies
with Zend OPcache v8.3.29, Copyright (c), by Zend Technologies
The exact version may vary depending on the latest packages available in AlmaLinux repositories.
Step 7: Test PHP Processing
Create a PHP test file:
sudo nano /var/www/html/info.php
Add:
<?php
phpinfo();
?>
Save and exit.
Open:
http://your-server-ip/info.php
If PHP is configured correctly, you'll see the PHP information page.
After testing, remove the file:
sudo rm -f /var/www/html/info.php
Step 8: Verify Database Connectivity
Access MariaDB:
sudo mariadb
Check the installed version:
SELECT VERSION();
Example output:
+------------------+
| VERSION() |
+------------------+
| 10.11.15-MariaDB |
+------------------+
1 row in set (0.000 sec)
Exit the database:
EXIT;
Common Service Management Commands
Start Apache:
sudo systemctl start httpd
Stop Apache:
sudo systemctl stop httpd
Restart Apache:
sudo systemctl restart httpd
Check Apache status:
sudo systemctl status httpd
Start MariaDB:
sudo systemctl start mariadb
Restart MariaDB:
sudo systemctl restart mariadb
Check MariaDB status:
sudo systemctl status mariadb
Final Thoughts
AlmaLinux 10 provides a stable and enterprise ready platform for hosting PHP based applications. By combining Apache, MariaDB, and PHP, you've created a reliable environment capable of powering everything from personal websites to large scale business applications.
With the LAMP stack now installed, you can move on to deploying WordPress, Laravel, Magento, Drupal, or any other PHP application on your AlmaLinux 10 server.

