Home ยป How to Install LAMP in Ubuntu

How to Install LAMP in Ubuntu

by Online Tutorials Library

How to Install LAMP (Linux Apache MySQL PHP) on Ubuntu?


LAMP is an acronym that used to refer a software suit, which contains Linux operating stem, Apache web server, MySQL database and PHP programming language.

It is also known as LAMP stack and used to developed dynamic web applications.

It is a group of softwares, so, either we can install all the component softwares independently or as a single unit.

In this tutorial, we will install LAMP on Ubuntu, this installation process includes the following steps.


  • Ubuntu
  • Terminal

LAMP Installation

1) Install

Open terminal, enter this single command, it will install complete LAMP stack into our system. If any package is present, will be skipped but new packages will be installed.

2) MySQL Configuration

During installation, MySQL prompts to configure database credentials. Click OK and proceed.

Software LAMP 1

3) Set Password

MySQL prompts for root password. So, enter password and click OK.

Software LAMP 2

4) Confirm Password

Repeat password to match previous entered password and click Ok.

Software LAMP 3

After setting password, MySQL install its packages and rest of the installation completes successfully.


Now, we will check that all the software has installed successfully or not.


Open terminal, enter following command to login into MySQL.

Software LAMP 4

Well, MySQL monitor is displayed, it means MySQL has installed successfully.


First start apache, access from the browser by entering localhost. Use this command to start Apache.

Software LAMP 5

It shows that Apache is working fine and has installed successfully.


To check PHP, create a info.php file inside /var/www/html directory. The info.php file contains the following code.

Access this file from the browser using localhost/info.php and it will show the following output.

Software LAMP 6

Well, we have set up LAMP stack successfully in our system.

You may also like