This tutorial presumes that you understand what is a LAMP Server , how to deploy a web site and how to install software using Terminal and experience in running other Basic Terminal Commands.

lamp

Root access
To install any application you need root access , You can prefix sudo before every command or login to root user and execute the commands

sudo -i

Enter the password of your account

Update
You need to update the local repo by fetching indexes from remote canonical repos

apt-get update

Apache
To install Apache you must install the Metapackage apache2. This can be done by running the following command.
apt-get install apache2

MySQL

To install MySQL you must install the Meta package mysql-server.

apt-get install mysql-server

Install PHP
To install php and apache lib for php if required install other libs like mysql lib and lots of other libs are available

apt-get install php5 libapache2-mod-php5

Check Apache
Open a web browser and navigate to that ubuntu IP

http://192.168.0.1/
You should see a message saying
It works!

Check PHP
You can check your PHP by executing any PHP file from within /var/www/.
Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file .
php -r ‘echo “nWow my installation is working.”;’