How to Install LAMP Stack on AlmaLinux 10
A LAMP stack is a group of open-source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL database, and dynamic content is processed by PHP.
Install Apache Web Server
First, we will start by installing the Apache web server. To complete the installation, use the following command.
dnf install httpd httpd-tools
Output:
[root@server ~]# dnf install httpd httpd-tools
Last metadata expiration check: 1:47:52 ago on Wed May 28 15:50:46 2025.
Dependencies resolved.
=============================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================
Installing:
httpd x86_64 2.4.63-1.el10 appstream 50 k
httpd-tools x86_64 2.4.63-1.el10 appstream 79 k
Installing dependencies:
almalinux-logos-httpd noarch 100.3-2.el10_0 appstream 18 k
apr x86_64 1.7.5-2.el10 appstream 128 k
apr-util x86_64 1.6.3-21.el10 appstream 98 k
apr-util-lmdb x86_64 1.6.3-21.el10 appstream 14 k
httpd-core x86_64 2.4.63-1.el10 appstream 1.3 M
mailcap noarch 2.1.54-8.el10 baseos 34 k
Installing weak dependencies:
apr-util-openssl x86_64 1.6.3-21.el10 appstream 16 k
mod_http2 x86_64 2.0.29-2.el10 appstream 161 k
mod_lua x86_64 2.4.63-1.el10 appstream 55 k
Transaction Summary
=============================================================================================================================================================================
Install 11 Packages
Total download size: 2.0 M
Installed size: 5.9 M
Once the installation is complete, enable Apache (to start automatically upon system boot), start the web server and verify the status using the commands below.
systemctl enable httpd
systemctl start httpd
systemctl status httpd
Output:
[root@server ~]# systemctl status httpd
Created symlink '/etc/systemd/system/multi-user.target.wants/httpd.service' → '/usr/lib/systemd/system/httpd.service'.
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
Drop-In: /etc/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Wed 2025-05-28 17:39:44 CDT; 30ms ago
Invocation: 6b9eb47946e645a5bad1726e5a901e9a
Docs: man:httpd.service(8)
Main PID: 2454 (httpd)
Status: "Started, listening on: port 80"
Tasks: 177 (limit: 36039)
Memory: 13.8M (peak: 14.3M)
CPU: 184ms
CGroup: /system.slice/httpd.service
├─2454 /usr/sbin/httpd -DFOREGROUND
├─2463 /usr/sbin/httpd -DFOREGROUND
├─2464 /usr/sbin/httpd -DFOREGROUND
├─2465 /usr/sbin/httpd -DFOREGROUND
└─2466 /usr/sbin/httpd -DFOREGROUND
To make your pages available to public, you will have to edit your firewall rules to allow HTTP and HTTPS requests on your web server by using the following commands.
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
Output:
[root@server ~]# firewall-cmd --permanent --zone=public --add-service=http
success
[root@server ~]# firewall-cmd --permanent --zone=public --add-service=https
success
[root@server ~]# firewall-cmd --reload
success
Verify that the web server is running and accessible by accessing your server’s IP address.
And restart tht Web Server to reflect the changes made.
systemctl restart httpd
From your browser,
http://IP_address
Note: Replace the IP_address with the actual IP address.
Install PHP 8.4 on AlmaLinux 10
This will help you to install PHP 8.4 on AlmaLinux 10 using EPEL and Remi repositories.
To begin, enable the CRB (CodeReady Builder) repository, which provides libraries required by some third-party packages,
dnf config-manager --set-enabled crb
Next, install the EPEL repository. This adds additional useful packages that aren't available in the default AlmaLinux repositories,
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
Now, install the Remi repository, which maintains the latest PHP versions for RHEL-based systems,
dnf install https://rpms.remirepo.net/enterprise/remi-release-10.rpm
Switch the system's PHP module to Remi’s PHP 8.4 stream to ensure packages are pulled from the correct source,
dnf module switch-to php:remi-8.4
Enable and install the PHP 8.4 module,
dnf module install php:remi-8.4
Verify PHP Installation
Check the installed PHP version to confirm success,
php -v
Output:
[root@server ~]# php -v
PHP 8.4.7 (cli) (built: May 6 2025 12:31:58) (NTS gcc x86_64)
Copyright (c) The PHP Group
Now restart your web server so that Apache knows that it will be serving PHP requests as well.
systemctl restart httpd
Test your PHP, by creating a simple info.php file with a phinfo() in it. The file should be placed in the directory root for your web server, which is /var/www/html
.
To create the file use:
echo "<?php phpinfo() ?>" > /var/www/html/info.php
Now again, access http://yourserver-ip-address/info.php
. You should see a page similar to one below.
Note: Replace yourserver-ip-address with actual IP Address
Install MariaDB Server
MariaDB is a popular database server. The installation is simple and requires just a few steps as shown.
dnf install mariadb-server mariadb
Output:
[root@server ~]# dnf install mariadb-server mariadb
Last metadata expiration check: 1:52:11 ago on Wed May 28 15:50:46 2025.
Dependencies resolved.
=============================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================
Installing:
mariadb x86_64 3:10.11.11-1.el10 appstream 1.6 M
mariadb-server x86_64 3:10.11.11-1.el10 appstream 9.9 M
Installing dependencies:
checkpolicy x86_64 3.8-1.el10 appstream 357 k
libaio x86_64 0.3.111-22.el10 baseos 24 k
mariadb-common noarch 3:10.11.11-1.el10 appstream 35 k
mariadb-connector-c x86_64 3.4.4-1.el10 baseos 206 k
mariadb-connector-c-config
Once the installation is complete, enable MariaDB (to start automatically upon system boot), start the MariaDB and verify the status using the commands below.
systemctl enable mariadb
systemctl start mariadb
systemctl status mariadb
Output:
[root@server ~]# systemctl status mariadb
● mariadb.service - MariaDB 10.11 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: disabled)
Active: active (running) since Wed 2025-05-28 17:43:40 CDT; 34ms ago
Invocation: 3bc94d3b798d436a801329082dd6ea82
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 3718 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS)
Process: 3741 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
Process: 3886 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS)
Main PID: 3873 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 11 (limit: 36039)
Memory: 204.2M (peak: 230.3M)
CPU: 1.097s
CGroup: /system.slice/mariadb.service
└─3873 /usr/libexec/mariadbd --basedir=/usr
Finally, you will want to secure your MariaDB installation by issuing the following command.
mysql_secure_installation
Output:
[root@server ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
Once secured, you can connect to MySQL and review the existing databases on your database server by using the following command.
mysql -e "SHOW DATABASES;" -p
Output:
[root@server ~]# mysql -e "SHOW DATABASES;" -p
Enter password:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
This concludes our topic of installing the LAMP stack on AlmaLinux 10.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS