This how-to information explains find out how to set up the newest model of Apache, MySQL (or MariaDB), and PHP, together with the required PHP modules, on RHEL-based distributions corresponding to Fedora, Rocky, and Alma Linux.
This mixture of the working system (Linux) with the online server (Apache), database server (MariaDB/MySQL), and server-side scripting language (PHP) is named the LAMP stack.
Step 1: Putting in Apache Net Server
Earlier than beginning the set up technique of the online server, be certain that your server is up-to-date by working the next yum or dnf instructions.
sudo yum replace
Or
sudo dnf replace
Subsequent, it is advisable to allow the epel repository, which is a community-based repository that gives add-on software program packages for RHEL-based Linux distributions corresponding to Rocky and Alma Linux.
sudo yum set up epel-release
Now you possibly can set up Apache, which is a extensively used open-source internet server software program that serves internet content material over the HTTP protocol.
sudo yum set up httpd
![Install Apache in Linux System](https://www.tecmint.com/wp-content/uploads/2013/10/Install-Apache-in-Linux-System.png)
As soon as the Apache internet server is put in, you possibly can allow it to start out mechanically at system boot.
sudo systemctl begin httpd
sudo systemctl allow httpd
sudo systemctl standing httpd
![Check Apache in Linux System](https://www.tecmint.com/wp-content/uploads/2013/10/Check-Apache-in-Linux-System.png)
In case you are working firewalld, make certain to permit Apache visitors on the firewall.
sudo firewall-cmd –zone=public –permanent –add-service=http
sudo firewall-cmd –zone=public –permanent –add-service=https
sudo firewall-cmd –reload
To entry the Apache internet web page after set up, open an internet browser in your laptop and kind the IP handle or hostname of your Linux server the place Apache is put in.
http://IP_address/
![Access Apache Web Page](https://www.tecmint.com/wp-content/uploads/2013/10/Access-Apache-Web-Page.png)
Step 2: Putting in PHP Utilizing Remi Repository
PHP is a free and open-source server-side scripting language that’s greatest suited to internet growth. It may be used to provide dynamic internet pages for a web site and is most ceaselessly present in Nix servers.
sudo yum set up php
![Install PHP in Linux](https://www.tecmint.com/wp-content/uploads/2013/10/Install-PHP-in-Linux-System.png)
One of many benefits of PHP is that it’s simply extensible by means of the usage of all kinds of modules.
sudo yum set up php-mysqlnd php-pdo php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear
![Install PHP Extensions in Linux](https://www.tecmint.com/wp-content/uploads/2013/10/Install-PHP-Extensions-Linux-System.png)
As soon as PHP is put in, restart the Apache service to use the modifications.
sudo systemctl restart httpd
Step 3: Putting in MySQL or MariaDB in Linux
On this part, we are going to present you the set up of each databases MySQL and MariaDB, so it’s as much as you what to decide on primarily based in your necessities.
Putting in MySQL in Linux
MySQL is without doubt one of the world’s hottest open-source relational database administration methods (RDBMS) that runs any server by offering multi-user entry to a number of databases. MySQL runs with Apache.
sudo yum set up mysql-server
Putting in MariaDB in Linux
MariaDB is a fork of the well-known MySQL, one of many world’s hottest relational database administration methods (RDBMS). It’s totally developed by the group and as such it’s supposed to stay FOSS and suitable with the GPL.
sudo yum set up mariadb-server
After profitable set up of MySQL or MariaDB, it’s time to start out the service and allow it to start out on boot.
sudo systemctl begin mysqld # For MySQL
sudo systemctl allow mysqld
sudo systemctl standing mysqld
sudo systemctl begin mariadb # For MariaDB
sudo systemctl allow mariadb
sudo systemctl standing mariadb
After set up, it’s important to safe your database server by working the next command and following the prompts to set a root password and take away insecure defaults.
sudo mysql_secure_installation
Step 4: Confirm Set up
As soon as Apache, MySQL/MariaDB, and PHP are put in, restart the Apache service to use the modifications.
sudo systemctl restart httpd
Subsequent, create a PHP check file known as information.php within the Apache doc root listing (/var/www/html/).
sudo echo “<?php phpinfo(); ?>” > /var/www/html/information.php
Now level your internet browser to the next handle and examine the presence of the put in modules and extra software program by scrolling down the web page (exchange [server] along with your area or the IP handle of your server).
http://your_server_ip/information.php
Your output ought to be just like:
![Access PHP Info Page](https://www.tecmint.com/wp-content/uploads/2013/10/Access-PHP-Info-Page.png)
Conclusion
Congratulations! You’ve got efficiently put in Apache, MySQL/MariaDB, and PHP in your RHEL server. With this LAMP stack arrange, you might be able to host and deploy dynamic web sites and internet functions.