Installing Apache Web Server On Linux
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.
Next you must give your new instance a name.
Next you will need to select your distribution.
In order to allow SSH you must have a Key Pair so next we will create the Key Pair.
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.
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.comYou get these commands from the EC2 Console. When you connect to your instance these commands are given to you.
Once these commands are complete your terminal should look like this…
You are officially IN!!!
Step 3: Install Apache
Before installing apache you should run the following command to update your system
sudo yum update -yThe next command is the command to install Apache
sudo yum install httpd -yThis 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 httpdThe second command is to enable Apache.
sudo systemctl enable httpdNow 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.
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/htmlNext run the following command to customize the html document
sudo nano index.htmlNow you must edit the document. We will change the landing page “It Works “ to “Welcome to LUIT- Red Team”
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”.
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!








