How To Install Linux, Apache, MySQL, PHP (LAMP) stack On RHEL 8

https:/‮ww/‬w.lautturi.com
How To Install Linux, Apache, MySQL, PHP (LAMP) stack On RHEL 8

To install the Linux, Apache, MySQL, PHP (LAMP) stack on RHEL 8, follow these steps:

  1. Enable the optional and extras repositories by running the following command:
sudo subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
  1. Install Apache by running the following command:
sudo yum install httpd
  1. Install MySQL by running the following command:
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.

  1. Start the MySQL service and enable it to start automatically on boot:
sudo systemctl start mariadb
sudo systemctl enable mariadb
  1. Install PHP by running the following command:
sudo yum install php

This will install PHP and the necessary PHP modules for use with Apache.

  1. Enable the Apache PHP module by running the following command:
sudo sed -i 's/^#LoadModule\ php7_module/LoadModule\ php7_module/' /etc/httpd/conf.modules.d/10-php.conf
  1. Restart Apache to apply the changes:
sudo systemctl restart httpd
  1. Test the LAMP stack by creating a PHP file in the Apache root directory. Run the following command to create a new file called 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.

  1. Open a web browser and visit 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.

Created Time:2017-10-16 14:38:43  Author:lautturi