aws-ubuntuAmazon(AWS) Hosting 

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on AWS Ubuntu

While Setting up the AWS or any other linux cloud hosting service there are many things we need to take care of while installing the LAMP stack to ubuntu.

AMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the virtual private server is already running Ubuntu, the linux part is taken care of. Here is how to install the rest.

Before Starting LAMP Installation you need to set the User Privileges  to root.
First login to your IP using Putty If your using windows else if you’re using Linux then use Terminal

first login to your hosting place and set privileges to do the things .

~user$ Sudo -su

Create a New User

After you have logged in and changed your password, you will not need to login again as root. In this step we will make a new user and give them all of the root capabilities.

You can choose any name for your user. Here I’ve suggested Demo

adduser demo

After you set the password, you do not need to enter any further information about the new user. You can leave all the lines blank if you wish.

Root Privileges

As of yet, only root has all of the administrative capabilities. We are going to give the new user the root privileges.

When you perform any root tasks with the new user, you will need to use the phrase “sudo” before the command. This is a helpful command for 2 reasons: 1) it prevents the user making any system-destroying mistakes 2) it stores all the commands run with sudo to the file ‘/var/log/secure’ which can be reviewed later if needed.

Also Read:  How to Detect Mobile Browsers and Redirect site in PHP

Let’s go ahead and edit the sudo configuration. This can be done through the default editor, which in Ubuntu is called ‘nano’


Find the section called user privilege specification. It will look like this:

# User privilege specification
root    ALL=(ALL:ALL) ALL

Under there, add the following line, granting all the permissions to your new user:

demo    ALL=(ALL:ALL) ALL

Type ‘cntrl x’ to exit the file. Press Y to save; press enter, and the file will save in the proper place.

Step 1: Installing of Apache

Apache is a free open source software which runs over 50% of the world’s web servers.

To install apache, open terminal and type in these commands:

sudo apt-get update
sudo apt-get install apache2

That’s it. To check if Apache is installed, direct your browser to your server’s IP address (eg.

How to Find your Server’s IP address to check web install

You can run the following command to reveal your server’s IP address.

ifconfig eth0 | grep inet | awk '{ print $2 }'

Arjun is is a web developer/designer, who is fond of the web. He lives in Manipal, Karnataka, India.

Related posts