How to install LAMP on ec2-instances

Here we are going to explain the Steps of installing the LAMP on ec2-instance .

  • For installing the LAMP first of all you should have the AWS account.
  • AWS offered the basic free tier for 1 year with limited space.
  • Just Go to and Click on “Sign in to the Console
  • If you have already registered user then fill the credential on below screen



  • If you don’t have the account then create a new here signup

Steps for Configuring the instance from AWS Dashboard

  • after login checkout the dashboard :-
  • login

Here we have ec2 instance Tab ,if you don’t found that on the welcome screen

than go to services->EC2 . Click on EC2 .

Then click on free tier only


  • Step 1: Choose an Amazon Machine Image (AMI)

Then select the Ubuntu 14.04 Instance for installing the LAMP

ubuntuStep 2: Choose an Instance Type – here you can choose free tier instances


Step – 3 – Configure Instance Details:-


Step – 4 Add Storage – Nothing to do ,you will get 30Gb free storage in free tier ,


Click on Add Tags – nothing is required in this section

  • Click on Configure Security Groups




  • click on Add Rule to access the instance from browser.


  • Now click on Review And Launch .


  • Click on Launch


if already have a key-pair than you can use that but i recommend to create a new one:-

1- create a new key pair from first drop down

2-key pair name (any thing you like)

3- click on Download Key Pair (keep the file safely)

4- click on Launch Instance





Click on View Launches


Here you can see info  like instance  running state,its IP address and so on.

now  we will install the LAMP on instance.

Download Useful Software for connecting to the command line

download the puttygen.exe


  • click on load and open the .pem file generated by the key pair.
  • click on generate and the .ppk file will  be downloaded which is required in ssh login
  • Click on Save Private key
  • Click ‘Yes’ on popup and name to a new .ppk file and file will be downloaded.
  • Download the putty.exe and open


1- Host Name –  IP address from AWS dashboard

2-In left side bar click on SSH than auth than browse the .ppk file which you have recently generated and click on open

3-you will get the putty security alert


click on yes next it will say login as : ubuntu (which is username)

Click yes on putty security alert and than you will be in command prompt of the instances

Here we will run commands and install LAMP  ,

Note :- in below command there will be some Y/N option will be come, choose Y to continue the operation.

LAMP Installations Command 

  • sudo su
  • apt-get update
  • apt-get install apache2
  • apt-get install mysql-server php5-mysql

it will ask for choose the server ,select apache / apache2 and ask for create  a new database password make it as you want .

  • apt-get install php5 libapache2-mod-php5 php5-mcrypt
  • service apache2 restart
  • a2enmode rewrite
  • service apache2 restart
  • apt-get install curl
  • service apache2 restart
  • cd var/www/html/
  • apt-get install php5 libapache2-mod-php5 php5-mcrypt
  • apt-get install phpmyadmin apache2-utils

Check for instance : – http://your IP Adrress /

Note :- if  phpmyadmin not worked tham

1-vim /etc/apache2/apache2.conf /// add the line to the end of the file:

2- Include /etc/phpmyadmin/apache.conf
3-/etc/init.d/apache2 restart

Congratulation you have successfully installed the LAMP on your ec2 ubuntu instance.

Run crone on AWS

Leave a Reply

Your email address will not be published. Required fields are marked *