RUNBOOK04: INSTALL APACHE HTTP SERVER ON AN AWS REDHAT LINUX EC2 INSTANCE AND CREATE A CUSTOM WEB PAGE

Sidra J.
4 min readOct 22, 2022

--

Hi cloud beauties,

Welcome back and hope you are having a very cloudy day!

Today I will go over more fun things in the cloud space.

  • I will be updating the software on a Linux AWS EC2 instance. If you do not have an EC2 instance, you can follow the steps listed here to create one and follow the steps here to connect to the EC2 instance using an SSH client.
  • I will install Apache HTTP Server. Apache is a free and open source software that allows users to easily deploy websites.
  • I will also create a custom web page that can be viewed on the internet.

Before we deploy any new packages on Linux servers, it is good practice to bring and keep the system up to date. Updates can prevent security issues and improve compatibility and program features

I updated the software on my RedHat EC2 instance using the yum command using root user privileges. yum is the primary tool for getting, installing, deleting, querying, and managing Red Hat Enterprise Linux RPM software packages from official Red Hat software repositories. This allows the instance to get the latest bug fixes and security updates.

sudo yum update -y

Just like I updated the available software on the EC2 instance using yum, I used yum to install the Apache web server with the following command.

sudo yum install -y httpd

When installing Apache the package is called httpd. It is designed to be run as a standalone daemon process.

Apache does not automatically start and needs to be started using super user privileges, so I used the following systemctl command to start it

sudo systemctl start httpd

I verified that it was running by checking the systemctl status of httpd

sudo systemctl status httpd

I went to the PublicIPv4 address of the instance from the EC2 Dashboard, expecting the Apache site to be up

http://54.89.113.149/

Unfortunately http://54.89.113.149/ took too long to respond

After doing some research I realized that the security group does not allow web traffic on ports 80 and 443 which are HTTP and HTTPS respectively, so I need to open that up

On the EC2 Dashboard, in the Security Tab for the instance , I clicked the security group- sg-0680da2e8ce874f47 (launch-wizard-1)

I clicked edit inbound rules

I clicked Add Rule and selected HTTP in the drop down menu and selected source as Anywhere-IPv4

I clicked Add rule again and selected HTTPS in the drop down menu and selected source as Anywehre-IPv4 then clicked Save rules

I am able to view the IPv4 DNS address now: http://54.89.113.149/

Back on my session in Putty I created an html webpage called index.html under /var/www/html/

I ran the command and inserted my html text

cd /var/www/html/

sudo vi index.html

Now when I went to the public IPv4 address http://54.89.113.149/, I see the following

As you can see, working in AWS is really easy! Thank you for joining me again today on my cloudy journey!

Sidra Javed (MSc, DIT 2023, ITILv3)

Cloud Engineer | DevOps Engineer | SRE | Production Application Support

LinkedIn | Tech Blog | GitHub | Schedule Time

--

--

Sidra J.

#womanintech #womaninstem #womaninit #womenempowerment #rebel #ladyengineer#muslim #fintech #cloud#devops #morganstanley