Sitemap
Devante Fields

Devante Fields

Installing Apache Web Server On Linux

--

Press enter or click to view image in full size

Overview

In this project Level Up Bank has requested for me to create a new web server using Amazon Linux 2. I will be deploying an EC2 instance, installing Apache, an open-source software that hosts websites and web applications, and verifying the website is working properly on its new server.

Step 1: Deploy EC2 Instance

To get started let’s navigate to the EC2 Console and Launch a new instance.

Press enter or click to view image in full size

Next you must give your new instance a name.

Press enter or click to view image in full size

Next you will need to select your distribution.

Press enter or click to view image in full size

In order to allow SSH you must have a Key Pair so next we will create the Key Pair.

Press enter or click to view image in full size
Press enter or click to view image in full size

Next you must create the security group for you instance. Make sure the security allows SSH traffic from anywhere as well as HTTP traffic from the internet.

Press enter or click to view image in full size

All other setting should be left as default and now the instance is ready to launch.

Step 2: SSH into the EC2 Instance

Now its time to connect to your instance. Navigate to the terminal and run the following commands

chmod 400 "apache_project_key.pem"
ssh -i "apache_project_key.pem" ec2-user@ec2-18-117-127-60.us-east-2.compute.amazonaws.com

You get these commands from the EC2 Console. When you connect to your instance these commands are given to you.

Press enter or click to view image in full size

Once these commands are complete your terminal should look like this…

Press enter or click to view image in full size

You are officially IN!!!

Step 3: Install Apache

Before installing apache you should run the following command to update your system

sudo yum update -y

The next command is the command to install Apache

sudo yum install httpd -y

This may take a few seconds so let the system install Apache and wait until you see complete at the bottom of your terminal.

Get Devante Fields’s stories in your inbox

Join Medium for free to get updates from this writer.

The next two commands are to start and enable the newly installed Apache. You must run these commands to ensure Apache is running properly.

The first command is to start Apache.

sudo systemctl start httpd

The second command is to enable Apache.

sudo systemctl enable httpd

Now you are ready to check the website. You will now navigate back tot he EC2 Console and locate the Public IPv4 address. Copy that address and paste it in a web browser. You should pull up a landing page.

Press enter or click to view image in full size

We have come to the landing page as you can see it shows the title It works! This will suffice for now.

Step 4: Create Custome HTML Page

To start the process of creating the custom HTML page you must first run the following command

cd /var/www/html

Next run the following command to customize the html document

sudo nano index.html

Now you must edit the document. We will change the landing page “It Works “ to “Welcome to LUIT- Red Team”

Press enter or click to view image in full size

Once the document is saved you can now go back to the EC2 Console and try your Public IPv4 address one more time. If done correctly the landing page will now show “ Welcome to LUIT- Red Team”.

Press enter or click to view image in full size

Conclusion

We have successfully created the new web server, installed Apache and shown that we are in control of the website and the website is running properly.

Mission Complete!

--

--