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.
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
For more detailed instructions with screen shots to guide the LAMP stack installation process for each command, continue reading below.
sudo apt-get update on the terminal.
$ sudo apt-get update
Successful update will have a similar message as the below image.
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.
sudo apt-get install apache2 on the terminal.
$ sudo apt-get install apache2
Apache2 is installed.
sudo apt-get install libapache2-mod-php5 on the terminal.
$ sudo apt-get install libapache2-mod-php5
PHP5 module for Apache 2 was installed.
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.
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.
Linux Apache MySql PHP (LAMP) stack was successfully installed.
Check Apache, MySql, and Php installations, read Check Apache, MySql, and PHP versions