AWS Tutorial – EC2 Configure Ubuntu Server Step by Step Tutorial

In this video, you will learn
1. How set up Ubuntu server in the AWS cloud using EC2 instance?
2. How to connect the server using the terminal through ssh?
3. How to Install apache on the server?
4. Also learn how to install php on it and clone with GitHub and test the php codes?

Register AWS Educate :

Host Static Site in AWS:

Using CodePipeline in AWS:

Open the AWS console page
Serch for the EC2 and open it
Click on launch Instance
Step 1: Choose an Amazon Machine Image (AMI)
Select the operating system as per your requirement.
As you can see the list of different operating systems included different other software as well.
We are going to setup Ubuntu Server 16.04 LTS server for now.
Select it
After selecting the type of server, the next job which is the second step is to choose the specification of the server. Like its size of RAM, CPU, etc.
For now, let’s select T2 micro which contains 1 core CPU and 1 GB RAM
Click Next to configure instance details
The third step is to Configure Instance Details
The number of instances: we can set up multiple instances as well. For now only one
The next step is adding storage means hard drive.

You can set up as per your requirement. If you are going through the windows server, it required a little more space than the Linux server. For now, let’s setup 8 GB memory which is sufficient for the Linux server. Another option is a volume type

You can choose the type of hard drives like General purpose SSD or provisioned IOPS SSD or magnetic type. SSD is expensive and faster than the magnetic hard drive. Let’s go with the SSD.
The fifth step is adding tags.
Use Tags to help to distinct the project. Like project Learning EC2
User Master2Teach
It also helps in the billing system report. Like in billing, we can filter the report according to tags like how much bill is under this project learning ec2 or how much bill is generated for user master2teach by these tags.

Next is Security Group

It’s all about configuring the security to the system which works as a firewall. We can choose either an existing security group or create our new security group.

Let’s configure a new security group for now.
Security group name: ec2-Linux-tutorial
Description: leave it attaches for now.

For SSH type of connection, using TCP protocol, in port no. 22, if there is a request from any IP address, then allow it.

If we are launching web application, then we need to allow connection through Http

HTTP type of connection, using TCP protocol, in port no 80, any IP address can access the web application. We can set up the specific IP as well here to allow the web application to access from that particular IP only.

For example, an online attendance system, to do attendance, you have to access from the college IP address which you have to specify there. That means you can do your attendance from the college internet only.

Next step is Review

Here is a warning that our server can access from world wide.

Let’s review our server details

We are going to set up a Ubuntu server with 1 core CPU 1 GB memory
In the security we all only for the ssh and HTTP connection.
Setup in this network
With 8gb storage capacity
And the tags.

Click the Launch button

A popup to select the key pair appears.
Download it.
Next launch the instance.
Open the terminal
For the windows user, you can use putty
For all guidance, select the instance and click connect button where you can see all details step by step to connect the server.

Let’s follow step by step
Open an ssh client which is our terminal for us
Locate your private key file it’s in my download folder
The third one, your key must not be publicly viewable for ssh to work.
Moving to the fourth one, connect to your instance using its public DNS
Install apache for the webserver so that we can run the PHP code.
1. Update the server – sudo apt-get update
2. Install Apache – Sudo apt-get install apache2
Furthermore, let’s install the PHP including some library
Sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
Upload all files and folder to the server from the GitHub
Add a new repo php
Clone with GitHub
Sudo git clone /php
In this way we can set up the Ubuntu server in amazon cloud, install apache, and PHP to run the PHP code and clone to GitHub to upload the file and folder easily.

SUBSCRIBE to our YouTube channel for more videos:

Like us on Facebook:

For more content go to




I am an avid Linux lover and open source enthusiast. I use Ubuntu and believe in sharing knowledge. Apart from Linux, I love classic detective mysteries.

8 thoughts on “AWS Tutorial – EC2 Configure Ubuntu Server Step by Step Tutorial

  • August 5, 2021 at 9:46 am

    Hi m getting an error. After giving password m getting a warning: you appear to have cloned an empty repository

  • August 5, 2021 at 9:46 am

    Very nice, my php website is uploaded and opening in the browser. But I am facing error while transferring form data(from index.php) to another php page(using $_server) method. {It is working fine on local machine)
    Can you tell why it's happening

  • August 5, 2021 at 9:46 am

    ubuntu@ip-172-31-57-49:~$ sudo apt-get install php libapache2-mod-php php-mcrypt php-mysqlReading package lists… Done

    Building dependency tree

    Reading state information… Done

    Package php-mcrypt is not available, but is referred to by another package.

    This may mean that the package is missing, has been obsoleted, or

    is only available from another source

    E: Package 'php-mcrypt' has no installation candidate

    (what should i do in this case??)


Leave a Reply

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