The LEMP stack, which includes Apache, MySQL, and PHP, is a popular web server configuration for hosting dynamic websites and applications. Here are the steps to install the LEMP stack on Almalinux:

1. Update the Almalinux system using the following command:


sudo yum update

2. Install Apache using the following command:


sudo yum install httpd

3. Start the Apache service using the following command:


sudo systemctl start httpd

4. Enable the Apache service to start at boot using the following command:


sudo systemctl enable httpd

5. Install MySQL server using the following command:


sudo yum install mysql-server

6. Start the MySQL service using the following command:


sudo systemctl start mysqld

7. Run the MySQL secure installation wizard to secure the MySQL installation and set the root password:


sudo mysql_secure_installation

8. Install PHP and the required modules using the following command:


sudo yum install php php-mysqlnd php-gd php-xml php-mbstring

9. Restart the Apache service to load the PHP module using the following command:


sudo systemctl restart httpd

10. Test the LEMP stack by creating a PHP info file. Create a new file called "info.php" in the "/var/www/html" directory using the following command:


sudo nano /var/www/html/info.php

Add the following code to the file:


<?php
phpinfo();
?>

Save the file and close the editor.

11. Open a web browser and navigate to the following URL to view the PHP info page:


http://your_server_ip/info.php

Replace "your_server_ip" with the IP address of your Almalinux server.

12. Remove the PHP info file for security purposes using the following command:


sudo rm /var/www/html/info.php

That's it! Now you have successfully installed the LEMP stack on Almalinux.

Kas see vastus oli kasulik? 23 Kasutajad peavad seda kasulikuks (135 Hääled)