Dipping Your Toes into Tech

A Beginner’s Guide Installing an Apache2 Server on Ubuntu 18.04 LTS Server & More

Melissa (Mel) Foster
Women in Technology
6 min readFeb 19, 2023

--

Wanting to transition into the World of Tech, with my goal set to be a Cloud Engineer. I discovered Level up in Tech. This program is designed to be intense. This doesn’t make it impossible for someone like me with little to no background surrounding tech. If you have the drive and dedication the possibilities are endless. If you’re like me, dipping your toes into tech and transitioning from another career this article outlines a great beginner’s project.

This is my first assignment, I am glad your here with me. Main objective is Installing an Apache2 Server on Ubuntu LTS. Now, I am a tiny bit familiar with Linux, and never used Ubuntu. (Ubuntu is a Linux Distribution.) To be honest, from my previous interactions with Linux I was dreading it. Nothing was ever explained in a way that made sense to me. However, don’t be intimidated, we got this!

Objective //

  • Update packages
  • Install an Apache HTTP Web Server
    We will be working an Ubuntu 18.04 LTS Server for this exercise

To follow along with this project you will need //

  • Access to a Cloud Server or an EC2 Instance
  • Terminal or PowerShell
  • Patience

Special Note //

Before we get started, I will give you the key that started the chain reaction to having a better experience with Linux & Ubuntu. Both OS operate with case sensitivity. Meaning, you will quickly learn that if you do not type it the way the command is written, you will have errors. It will happen, you cannot avoid it one hundred percent of the time, we are human, but save yourself some headaches and double check your work. It could be an error simply because you missed a space or capitalized when the command is lowercase.

Now, let’s get started //

First, we are going to connect to our Cloud Server by ssh* through your Terminal, if you are a Mac User, or through PowerShell, if you are on a Windows User. (*SSH is a method for secure remote login from one computer to another.)

You will be prompted to enter the coordinating password, and if this is your first time connecting you will be prompted to enter a new password. *Note you will not see your password. If you are using a copy paste method in PowerShell and are receiving an error, try to paste using SHIFT+Ctrl+V. Once entered you should now be connected remotely to your server.

Now, let’s get to updating our server by finding out how many packages need updated. To do this we need to have authority to do so, to make sure we have access to update we will start our command with sudo. (Sudo stands for super user do which allows you to temporarily elevate your current user account to have root privileges.) The full command will be:

cloud_user@5052cbfaa32c:~$ sudo apt update     

You will then be prompted to reenter your password.

Your screen should now look like:

We now can see that we have 8 packages that can be upgraded. Our next command to continue is to upgrade our packages.

 cloud_user@5052cbfaa32c:~$ sudo apt upgrade

Oh no an error! Remember case sensitive and the full command needs to be typed. Let’s try that again. You should get a prompt to select y/n to continue. Type y and hit enter, your packages will begin to update.

Once installs are complete you will be back at your command line, ready for the next step. To clear your screen to make it a little more easier to view you can enter the command:

cloud_user@5052cbfaa32c:~$ clear

Let’s install an Apache HTTP Web Server. We are once again going to use the sudo command:

cloud_user@5052cbfaa32c:~$ sudo apt-get install apache2

Once again, you will be prompted to choose y/n, type y and hit enter. Your screen should start to look the next image and afterwards you will be back at your command line.

To verify that Apache2 was installed you can use the command:

cloud_user@5052cbfaa32c:~$ apache2 -v

Now, we know that Apache2 is installed we need to ensure that it is enabled, to do this we will run the command:

cloud_user@5052cbfaa32c:~$ sudo systemctl enable apache2

To check the status of Apache to verify it is enabled we run command:

cloud_user@5052cbfaa32c:~$ sudo systemctl status apache2

Before we move onto creating our HTTPS we need to make sure our firewalls are enabled. Ubuntu should have a user-friendly (ufw) installed by default. To be thorough we will install the ufw using the following command:

cloud_user@5052cbfaa32c:~$ sudo apt install ufw -y 

We now need to permit incoming ssh connections by running:

cloud_user@5052cbfaa32c:~$ sudo ufw allow ssh 

This step ensures access will not be blocked enabling the firewall. To enable the firewall we will need to run the command:

cloud_user@5052cbfaa32c:~$ echo -y |sudo ufw enable

If you are following along with commands so far, your screen should look like this:

Before moving onto what I consider the fun part we need to verify our status:

cloud_user@5052cbfaa32c:~$ sudo ufw status

Awesome job so far! Let’s have some fun! Let’s find the index.html file using command:

cloud_user@5052cbfaa32c:~$ cd /var/www/html

You can you the command: $ ls to list out that there is a file showing index.html. We want to spruce up our html and customize it a bit. To do this we will be using the command:

cloud_user@5052cbfaa32c:~$ sudo vim index.html

Now, it has opened to something like the screen below. We are going to insert ourselves by hitting I. You should be able to move your cursor throughout, we will use our directional arrow keys to move down to the title and update that to Welcome to LUIT Green Team. You can fully customize, so go for it if you want to take the extra time. To exit and save it you will first hit ESC Key then type :wq

I fully customized my page just because I wanted to try. When you are first starting out, researching and expanding your knowledge is challenging but worth it!

Alright we should be up and running! Let’s obtain our server’s public IP address by using command:

cloud_user@5052cbfaa32c:~$ curl -4 icanhazip.com

And the BIG MOMENT has arrived….. Let’s pull up our hard work on our web browser by searcher out IP address. http://[server_public_ip_address]

I am so proud of you sticking it out with me! Do you have an overwhelming sense of accomplishment? I know I do, for my first project I am motivated to keep learning and growing!

Edited Logos

Join me on https://www.linkedin.com/in/melissafoster08/ or follow me at https://github.com/mel-foster

All Screen Capture Images ©Melissa (Mel) Foster

--

--

Melissa (Mel) Foster
Women in Technology

𝔻𝕖𝕧𝕆𝕡𝕤 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿 |𝒲𝑜𝓂𝑒𝓃 𝐼𝓃 𝒯𝑒𝒸𝒽 𝒜𝒹𝓋𝑜𝒸𝒶𝓉𝑒 | 𝚂𝚘𝚌𝚒𝚊𝚕 𝙼𝚎𝚍𝚒𝚊 𝙲𝚛𝚎𝚊𝚝𝚘𝚛 | Photographer