To install the Linux, Apache, MySQL, PHP (LAMP) stack on RHEL 8, follow these steps:
sudo subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
sudo yum install httpd
sudo yum install mariadb-server
During the installation process, you will be prompted to set a root password for MySQL. Make sure to choose a strong password and remember it, as you will need it later.
sudo systemctl start mariadb sudo systemctl enable mariadb
sudo yum install php
This will install PHP and the necessary PHP modules for use with Apache.
sudo sed -i 's/^#LoadModule\ php7_module/LoadModule\ php7_module/' /etc/httpd/conf.modules.d/10-php.conf
sudo systemctl restart httpd
info.php
:sudo nano /var/www/html/info.php
Add the following lines to the file:
<?php phpinfo(); ?>
Save the file and exit the editor.
http://localhost/info.php
. You should see a page displaying information about your PHP installation. If you see this page, it means that the LAMP stack is working correctly.That's it! You now have a fully functional LAMP stack on your RHEL 8 system. You can now use PHP and MySQL to develop web applications.