- Steps to Install LAMP on AlmaLinux 8
- 1. Run system update
- 2. Install Apache web server on AlmaLinux 8
- 3. Enable and start Apache
- 4. Update FireWall rules
- 5. Install MySQL (MariaDB) on AlmaLinux8
- MySQL installation command:
- MariaDB installation command:
- 6. Secure MySQL installation
- 7. Install PHP 7.2/7.3/7.4 or 8.0 on AlmaLinux 8
- 8. Verify the Version of PHP Installed
- 9. Install PHP 8.0 (remi) on AlmaLinux 8
Steps to Install LAMP on AlmaLinux 8 #
The steps are described here to install and set up a Lamp server on AlmaLinux 8 can also be used for CentOS 8 Stream and RHEL 8 Linux server or desktop systems.
1. Run system update #
One of the necessary steps before running the installation programs is to run the command to update the system. This helps us to make sure all the installed packages are in their latest state but also rebuild the system repository cache. This helps in the process of any software or services installation running smoothly.
Write ” y ” and Enter.
2. Install Apache web server on AlmaLinux 8 #
The next step is to install the Apache webserver on AlmaLinux along with some other tools to run
httpd on this free RHEL based on Linux operating system. Now install the Apache package with the following command:
again, Write ” y ” and Enter.
3. Enable and start Apache #
Once the webserver is installed, let’s start its service and also make it automatically up with the system boot. This will ensure whenever you boot AlmaLinux you won’t need to start Apache manually.
After installing Apache and applying its settings, we will now check its Status:
4. Update FireWall rules #
If you want to access the Apache webserver outside your local machine using some browser, then first we have to open ports 80 and 443 on our AlmaLinux server.
How open port 80 or HTTP in Almalinux 8 :
How open port 443 or HTTPS in Almalinux 8:
Reload firewall to make changes into effect:
Well the installation is complete! Now by entering the IP address in the browser we can see the result:
5. Install MySQL (MariaDB) on AlmaLinux8 #
MySQL is a freely available open-source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). SQL is the most popular language for adding, accessing, and managing content in a database. It is most noted for its quick processing, proven reliability, ease and flexibility of use.
MariaDB is a fork that works similarly and uses the same command line as MySQL. You can install any of them as per your choice.
MySQL installation command:
MariaDB installation command: #
How Start & Enable MySQL and MariaDB services on Almalinux :
—– check status
—– check status
6. Secure MySQL installation #
This step will be the same whether you are using MySQL or MariaDB, it will give some options to follow and set some settings so that we can secure of Database from any common future threats.
in this process, You will be asked to Set root Password, Remove anonymous users, Disallow root login remotely, Remove test database, Reload privilege tables, and need Enter ” Y ” to do them.
- Enter current password for root (enter for none):
- Set a root password? [Y/n]
- Remove anonymous users? [Y/n]
- Disallow root login remotely? [Y/n]
- Remove test database and access to it? [Y/n]
- Reload privilege tables now? [Y/n]
7. Install PHP 7.2/7.3/7.4 or 8.0 on AlmaLinux 8 #
PHP (recursive acronym for PHP: Hypertext Preprocessor) is an open-source, popular general-purpose scripting language that is widely-used and best suited for developing websites and web-based applications. It is a server-side scripting language that can be embedded in HTML.
Currently, there are three supported versions of PHP, i.e PHP 5.6, 7.0, and 8.0. Meaning PHP 5.3, 5.4, and 5.5 have all reached the end of life; they are no longer supported with security updates.
First, check what are PHP versions available to install:
The output clearly shows that the default module is PHP 7.2 with the
To install PHP 7.4, first enable the module as provided.
NOTE: To enable a different module, simply replace 7.4 with the preferred version. For example, to enable 7.3 run:
Once installed, install PHP and associated PHP extensions (php-extension_name) as indicated. The PHP extensions installed in this example are as shown.
To get better performance for various applications using PHP, we can start (if not already) and enable PHP-FPM (FastCGI Process Manager) using the below commands:
8. Verify the Version of PHP Installed #
Once the installation is complete, verify the version of PHP installed.
The output above confirms that we have successfully installed PHP 7.4.
But since we have installed Apache web server and php, it is better to see if PHP works properly with web server?
So we create a file called test.php in the following path and open it with our favorite editor:
Add the following line in the test.php file we have created using the above command:
To save the file type: Ctrl+X, press the Y key, and then Enter key.
Now, open your browser and type your server IP address along with file name test.php, we have created above:
9. Install PHP 8.0 (remi) on AlmaLinux 8 #
If you want to install the php version you want with the remi repository (for example, install php 8) follow these steps:
1. Add Remi Repository #
2. Run system update #
3. Check available Latest PHP versions #
To install it first you have to set Remi’s PHP 8.0 as the default version to install on AlmaLinux 8, for that run: If you also want to manage your MySQL or MariaDB database using web graphical user interface then see our article: Install phpMyAdmin on AlmaLinux 8 with Apache
10. Install phpMyAdmin on Almalinux 8
To install it first you have to set Remi’s PHP 8.0 as the default version to install on AlmaLinux 8, for that run:
If you also want to manage your MySQL or MariaDB database using web graphical user interface then see our article: Install phpMyAdmin on AlmaLinux 8 with Apache