Install apache 2 on aws ec2 instance ubuntu. Here, we will show you how to install apache 2 web server on aws ec2 instance ubuntu linux.
Use the below-given steps to install Apache 2 on AWS ec2 instance ubuntu 18.04:
- Install Apache 2 on Ubuntu 18.04
- Setup Firewall with UFW on Ubuntu 18.04
Install Apache 2 on Ubuntu 18.04
Step 1: Connect Your AWS EC2 Intance from SSH
First of all, you need to connect your aws ec2 instance from ssh. If you are new to connect aws ec2 instance with windows, ubuntu and mac system. So you can read this tutorial “How to Connect to ec2 Instance From Putty and SSH Terminal” to connect your ec2 instance from ssh.
Step 2: Update Ubuntu System Repositories
In this step, you need to download the latest version of the software by first updating the local package index of Ubuntu repositories. So, start your ssh terminal and type the below given command:
sudo apt update
Step 3: Install Apache 2
In this step, use the below given command to install apache 2 into your ubuntu web server. So, open ssh terminal again and run this sudo command to install apache web server on aws ec2 instance:
sudo apt install apache2
Note that, on running installation of apache 2 web server on aws ec2 instance. The prompt box will be open with a “Y/N” option to continue the installation.
Please enter Y, after which the installation process will begin.
Step 4: Verify the Apache installation
Installing Apache2 web server on your Ubuntu 18.04 EC2 instance is completed. So, open your ssh terminal and type the below command to check the Apache 2 is installed or not on our Ubuntu 18.04 aws EC2 instance:
Congratulation!!, You have successfully installed the Apache 2 web server on AWS ec2 instance.
If you want to access it from outside. So, you need to update firewall settings on your apache 2 web server on your Ubuntu 18.04 EC2 instance.
Setup Firewall with UFW on Ubuntu 18.04
Step 1: List the UFW application profiles
In this step, open your terminal ssh and type the following command to list such available firewall ufw applications,:
sudo ufw app list
Step 2: Allow Apache Full on UFW
In this step, you need to allow Apache Full on UFW will open port 80 and 443 for network traffic, while providing maximum security to the server. So, use the below given UFW command to allow Apache Full through the following command:
sudo ufw allow 'Apache Full'
Step 3: Verify that the Apache service is running
sudo systemctl status apache2
Finally, open your browser and type your AWS ec2 instance IP address. And, it will be looks like the Apache 2 page in the following picture:
Install apache on AWS ec2 instance ubuntu tutorial, You have learned how to install apache 2 on aws ec2 ubuntu.