LAMP Stack Configuration on Ubuntu: Apache, MySQL, PHP

LAMP Stack Configuration on Ubuntu: Apache, MySQL, PHP

How to Install LAMP on Ubuntu:

Step 1: Install Apache Web Server

  1. Open the terminal and enter the following commands:
    sudo apt update 
    sudo apt install apache2
  2. Start Apache and enable it to start on boot:
    sudo systemctl start apache2 
    sudo systemctl enable apache2
  3. Check if Apache is running by entering your server’s IP address or http://localhost in your web browser.

Step 2: Install MySQL Database Server

  1. Open the terminal and install the MySQL server:
    sudo apt install mysql-server
  2. Set a root password during the installation process.
  3. Start MySQL and enable it to start on boot:
    sudo systemctl start mysql 
    sudo systemctl enable mysql

Step 3: Install PHP

  1. Enter the following command to install PHP and establish the connection between PHP and Apache:
    sudo apt install php libapache2-mod-php php-mysql
  2. Restart Apache to apply the changes:
    sudo systemctl restart apache2
  3. Verify that PHP is successfully installed:
    php -v
  4. Create a PHP info page using the following command:
    echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/phpinfo.php

    Visit http://localhost/phpinfo.php in your web browser to view PHP information.

Conclusion:

By following these steps, you have successfully installed a LAMP stack on Ubuntu. You can now start developing web applications and test your installation.

You May Also Like
Proxmox commands cheat sheet terminal output
Read More

Proxmox Commands – cheat sheet

Managing Proxmox Virtual Environment (PVE) through the command line can significantly speed up administration tasks, especially when working…
secure ssh configuration changing default ssh port for linux and windows servers
Read More

How to Change the SSH Port

Why Change the Default SSH Port? Changing the default SSH port is a common security practice that helps…