A basic stage in hosting websites and web applications is setting up a LAMP (Linux, Apache, MySQL, PHP) stack. For this, the stable and open-source Linux distro AlmaLinux is a great option. We’ll walk you through setting up a LAMP stack on AlmaLinux in this blog. So your web server is operational, up and running. For those managing server needs in India, dedicated server solutions offer a practical and economical choice for reliable performance.

Open-source Linux OS AlmaLinux will take the role of CentOS. Which is about to approach End-of-Life (EOL) and will no longer get updates. Comparing AlmaLinux, and CentOS you’ll find that AlmaLinux is a direct substitute for CentOS. Having a simpler installation method and a longer lifespan. Explore options for top-tier VPS hosting with cPanel for 2024,  with safety standards that provide a blend of powerful features and user-friendly management tools.

The set of open-source server software used to handle static and dynamic websites is known by the name LAMP. If you have the right user permissions, you can follow this instruction to set up your server.

The LAMP Stands As:

L: is the operating system Linux.
A: The web server Apache.
M: The database management system (DBMS) is MariaDB or MySQL.
P: is the backend PHP coding language used in website development and maintenance.

Install Lamp Stack on AlmaLinux

Before installing the lamp stack if you want to understand in detail about LAMP that creates dynamic and robust web applications, our detailed guide on the LAMP stack.

Step 1: Set up Apache.

Since the AppStream AlmaLinux repository contains all of the essential software, it is not necessary to implement a separate repository to deploy the LAMP Stack on AlmaLinux. Enter the following command in your terminal to open it and log in as the root user.

sudo su -

Step 2: Install the Apache Web Server by using the Command below.

dnf install -y httpd

Step 3: After the Apache Installation is Finished, the httpd service needs to be Started and Enabled.

systemctl start httpd

systemctl enable httpd

You can verify that your Apache web server is installed and operating properly by looking up the http service status and making sure it is listening on port 80 by default. To find out the current state of your http service, run the following command.

service httpd status

If everything is set up properly, your output should be like the sample below.

command to start and enable httpd service

Step 4: Next, use these Commands to Enable HTTP and HTTPS Traffic over your Firewall.

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

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

Use the following command to restart your firewall so that the new firewall rules take effect.

firewall-cmd --reload

Installing the Apache Web Server has gone well.

Set up MySQL.

The AppStream AlmaLinux repository will work for the MySQL installation. To swiftly install the MySQL database management system, use the following command.

dnf install -y mysql mysql-server

Once the installation is finished, type the following lines into your terminal to start and enable the mysqld service to run every time the system boots up.

systemctl start mysqld

systemctl enable mysqld

It is advised that you take extra precautions to protect your server from malevolent users. Use the following command in your terminal to prevent frequent attacks on your MySQL database server.

mysql_secure_installation

Additional configuration steps will be offered to you; generate your DBMS password and then respond with y to all of the prompts. MySQL has been installed safely and successfully.

Use the following command to log in.

mysql -u root -p

Installing PHP 8.0 on AlmaLinux 8

At the time of posting, PHP 8.0 is the most recent version compatible with AlmaLinux. Use the following command to update the system packages and install PHP 8.0 on AlmaLinux.

dnf update

Next, look through the AppStream AlmaLinux repository’s PHP module versions that are available.

dnf module list php

The accessible PHP versions—in this case, PHP 8.0—are contained in the output. To enable the PHP 8.0 module, use the following command.

dnf module enable php:8.0

Lastly, run the following command to install PHP on your AlmaLinux system along with a few of the suggested extensions.

dnf install php php-fpm php-zip php-intl php-opcache php-gd php-mbstring php-gd php-xml php-mysqlnd

Run an Installation Test

After the LAMP stack installation on AlmaLinux is complete. Verify that Apache, MySQL, and PHP are configured. The following commands can be used to determine whether the installation was successful. Success is defined by seeing if they return the appropriate versions.

Details For Apache

To find out the version of Apache, use this command.

httpd -v

The version is displayed in the output example below.

command to check status of http service

Details for PHP

The command to verify the PHP version is provided here.

php -v

This is an example of the output.

command shows the apache version

Details For SQL

The MySQL version can be verified by using the following command.

mysql --version

This is an example of an output.

mysql Ver 8.0.30 for Linux on x86_64 (Source distribution)

If every command yields an output similar to the one shown above, your LAMP stack is correctly deployed and operational.

Final Thought on Install LAMP Stack on AlmaLinux

You are now prepared to launch and host websites and web applications. With Apache handling your web content. MySQL handles your databases, and PHP drives your dynamic web applications. With this adaptable configuration, you can investigate the realm of web development on a reliable and safe platform.

This process of installing the LAMP stack on AlmaLinux with this detailed tutorial. Install Apache Web Server, MySQL client and software, and PHP version 8.0 by following this method. Installing and configuring LsyncD or setting up an FTP server. Accounts are further factors to take into mind. Transform your AlmaLinux server into a powerful hosting platform with our detailed guide on installing WHM/cPanel in AlmaLinux.

For your website hosting requirements, DedicatedCore provides VPS Hosting. Also provides Cloud Dedicated Servers and Dedicated Servers. Being able to install the LAMP stack on AlmaLinux puts you ahead of the game when it comes to website hosting.