How to install linux apache mysql php lamp on ubuntu

  • Install Linux then open up the terminal then use the following command
  • Install Apache
Sudo apt-get update 
Sudo apt-get install Apache2
  • Install MySQL (Myseqal) you can install MySQL server by running the following command
sudo apt-get install mysql-server
  • Install PHP: You can install PHP and the required Apache module by running the following command
sudo apt-get install php libapache2-mod-php
  • Configure Apache to Use PHP: You can configure Apache to use PHP by editing the Apache configuration file. By default, this file is located at /etc/apache2/mods-enabled/dir.conf. Change the contents of the file to look like this:
<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
  • Restart Apache: Finally, restart the Apache web server to apply the changes:
sudo systemctl restart apache2
  • Your LAMP server is now up and running! You can test it by creating a file called info.php in the /var/www/html directory and adding the following contents:
<?php
phpinfo();
?>
  • You can access the file in a web browser by navigating to http://your-server-ip/info.php. This should display information about your PHP installation.