Install LAMP Server on Ubuntu: Step-by-Step

To install and configure a LAMP server on Ubuntu, you can follow the steps below:

  1. Install Apache server.

Open the terminal and run the following command to install the Apache server.

sudo apt update
sudo apt install apache2
  1. Install MySQL database.

Continue running the following commands in the terminal to install the MySQL database:

sudo apt install mysql-server

During the installation process, you will need to set the root password for the database.

  1. Install PHP.

Continue running the following commands in the terminal to install PHP and its related modules:

sudo apt install php libapache2-mod-php php-mysql
  1. Setting up the Apache server:

Enable the PHP module in the terminal and reload the Apache server configuration file.

sudo a2enmod php
sudo systemctl restart apache2
  1. Test the LAMP server.

If you enter http://localhost/ in your browser and see the default Apache page, it means the LAMP server has been successfully installed and configured.

Now, you can start using a LAMP server on Ubuntu to build a website or application.

bannerAds