Install LAMP on Ubuntu in six easy steps

May 25, 2013 | Updated last October, 2015 | 1415 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

 

Latest Tutorials



Install Eclipse Oxygen IDE on CentOS 7


Run Tomcat Server as a Service in CentOS 7


Install JAVA 1.8 and Tomcat Server 9 in CentOS 7


Launch an AWS MySQL DB Instance


Get current MySQL auto increment value of a certain TABLE.


Change MySQL auto increment value


Download and save a file from the web using JAVA


Read a file inside of JAR in JAVA


Read a file outside of JAR in JAVA


Create excel files in JAVA


Read excel files in JAVA


Install SOLR 5.x


Spring 4 MVC Multiple File Upload Example


Spring 4 MVC JSON Hello World Annotation Example


Create a File Uploader using jQuery and Bootstrap


Spring 4 MVC File Upload Example


Spring Security 4 JAVA Config In Memory Authentication Authorize Requests Security Method


Generate BCrypt Hashed Passwords using Spring Security 4


Spring Security 4 XML Config JDBC Authentication Annotation Security Method


Spring Security 4 XML Config In Memory Authentication Intercept Url Security Method


Spring Security 4 XML Config In Memory Authentication Annotation Security Method


Spring 4 MVC Hello World Annotation Example


Spring 4 MVC Hello World Bean Name Url Handler Mapping Example


Spring 4 MVC Hello World Simple Url Handler Mapping Example


Spring 4 MVC Hello World Class Name Handler Mapping Example


Generate and Configure Git SSH Key on Linux


Create a New JAVA Class on Eclipse IDE


Create a New Package on Eclipse IDE


Create a New Maven Project in Eclipse


Configure Run on Server option on a Maven Project on Eclipse IDE


Create a NodeJs Hello World example


Install NodeJs on CentOS


Integrate Maven in Eclipse


Check Apache, MySql, and PHP versions


Remove an option from a select box


Rotate an image in PHP


Select an element by name with jQuery


Check if a checkbox is checked with jQuery


Generate Random Passwords in PHP


Generate random strings using PHP


Watermark an image in PHP in four different ways


Add a text watermark using a True Type Font to an image with PHP


Add a text watermark to an image with PHP


Use imagecopymerge() to watermark an image with PHP


Watermark an image with PHP using imagecopy()


Combine a transparent PNG image on top of another image with PHP


Combine images using PHP


Write text to an image using TrueType fonts in PHP


Center a text on an image using imagestring()


Create an image with custom text in PHP


Create an image with PHP


Convert JSON to XML using PHP


Convert XML to JSON in PHP


Read XML files using jQuery


Read XML files in PHP


Create an XML file with PHP


Parse JSON file with jQuery


Parse JSON file with PHP


Create a JSON file in PHP


Know the difference between bindParam() and bindValue() in PDO


Bind a parameter to a variable using bindValue() in PDO


Bind a parameter to a variable using bindParam() in PDO


Scroll to an element using jQuery


Create a PDF file in PHP


Match the beginning of a Class or ID in jQuery


Edit an excel file using PHPExcel


Access a MySQL database from the terminal


Grant a privilege to a MySQL user on a database


Create a MySQL database user


Change font style in PHPExcel


Merge cells in PHPExcel


Change array values to lowercase or uppercase in jQuery


Check if a string is in an array in jQuery


Create an excel file in PHP


Read an excel file in PHP


Use a variable to match or replace a string in Javascript


Insert new records to a MySQL database using PDO in PHP


Update a MySQL record using PDO in PHP


Delete MySQL records using PDO in PHP


Select MySQL database records using PDO in PHP


Access MySQL database using PDO in PHP


Restore a MySQL backup file (.sql) from the terminal


Backup MySQL database into an .sql file from the terminal


Install LAMP on Ubuntu in six easy steps


Develop a Spring3 MVC Hello World Annotation Application