How To Install Linux, Apache, MySQL, PHP (LAMP) stack On RHEL 8
Installing a LAMP (Linux, Apache, MySQL, PHP) stack on RHEL 8 can be done by following these steps:
- Install Apache web server:
sudo dnf install httpd- Start the Apache service and enable it to start automatically at boot time:
sudo systemctl start httpdrnsudo systemctl enable httpd- Install MySQL server and client:
sudo dnf install mariadb-server mariadb- Start the MySQL service and enable it to start automatically at boot time:
sudo systemctl start mariadbrnsudo systemctl enable mariadb- Secure your MySQL installation by running the following command:
sudo mysql_secure_installation- Install PHP and the PHP module for Apache:
sudo dnf install php php-mysqlnd- Enable the PHP module for Apache by editing the Apache configuration file:
sudo nano /etc/httpd/conf.d/php.confand add the following line:
LoadModule php7_module modules/libphp7.so- Restart the Apache service to apply the changes:
sudo systemctl restart httpd- Verify that PHP is working by creating a file called
info.phpin the Apache document root directory:
sudo nano /var/www/html/info.phpwith the following contents:
<?php
phpinfo();
?>- Access the file in a web browser:
http://your_server_ip/info.phpThe above steps will install a LAMP stack on your RHEL 8 system. You can now use this stack to host dynamic websites and web applications that use PHP and MySQL.
