Install LAMP on Ubuntu in six easy steps

May 25, 2013 | Updated last October, 2015 | 872 views | Comments

Only six easy steps are needed to install Linux Apache MySql Php (LAMP) Stack on Ubuntu.

Note: This LAMP installation was specifically tested to be working correctly on Trusty Tahr Version (14.04.2 and 14.04.3). Other lower versions might need more installation adjustments depending on the desired version of Apache, MySql, and Php you want to install. For newer versions, it is always better to install the latest stable available application.

The following applications with specific version will be installed.

  • Apache 2
  • Mysql Server 5.5
  • PHP 5.5.9

Let's begin!

Just execute the following commands one by one, wait for each command to be completed before moving to the next one, and you are done.

$ sudo apt-get update
$ sudo apt-get install php5
$ sudo apt-get install apache2
$ sudo apt-get install libapache2-mod-php5
$ sudo apt-get install mysql-server-5.5
$ sudo apt-get install php5-mysql

 

That is quick and easy.

For more detailed instructions with screen shots to guide the LAMP stack installation process for each command, continue reading below.

1. Update Ubuntu

Type sudo apt-get update on the terminal.

$ sudo apt-get update

Successful update will have a similar message as the below image.

 

2. Install PHP 5

Type sudo apt-get install php5 on the terminal.

$ sudo apt-get install php5

Required disk space will be shown, and you will be ask if you want to continue, type Y and hit enter key to accept.

You have successfully installed PHP5 when you see a message like the one below.

 

3. Install Apache 2

Type sudo apt-get install apache2 on the terminal.

$ sudo apt-get install apache2

Apache2 is installed.

 

4. Install PHP5 module for Apache 2

Type sudo apt-get install libapache2-mod-php5 on the terminal.

$ sudo apt-get install libapache2-mod-php5

PHP5 module for Apache 2 was installed.

 

5. Install MySql Server 5.5

Type sudo apt-get install mysql-server-5.5 on the terminal.

$ sudo apt-get install mysql-server-5.5

You will be asked if you want to continue after showing the needed disk space. Type Y and hit enter key to accept

Enter your desired root password.

Note: Do not forget this password, and keep this somewhere safe.

Confirm the root password.

MySql was successfully installed.

 

6. Install PHP 5 module for MySql Server 5.5

Type sudo apt-get install php5-mysql on the terminal.

$ sudo apt-get install php5-mysql

Installation successful, PHP 5 module for MySql Server 5.5.

That's all!

Linux Apache MySql PHP (LAMP) stack was successfully installed.

 

What's next?

Check Apache, MySql, and Php installations, read Check Apache, MySql, and PHP versions

 

Related Tutorials


Must Read