An “Always Free” Web Server Platform – Virtualization Review

Using Oracle Cloud Part 2: An “Always Free” Web Server Platform

Tom Fenton details the web server work he did in his experience using an Ubuntu 18.04 “Always Free” virtual machine on Oracle Cloud to host a small website.

In a previous post, I detailed how it took less than 10 minutes to sign up, create, and use an Ubuntu 18.04 “Always Free” virtual machine (VM) on Oracle Cloud. Yes, the free VM wasn’t that big (1 vCPU and 4 GB of RAM), but I thought it would allow for the creation of a small website – a good test of Oracle Cloud because the site Web on the virtual machine would need to be open to allow access to the outside world. In this article, I will discuss the web server I chose to use, how I installed it, and how well it worked.

Why Apache
The #1 priority for my web server was simplicity; I just wanted a basic website that displays a “Hello World” message. I wanted to verify that a VM on Oracle Cloud would support an application like a web server and allow connectivity to the outside world.

Apache is a free, open-source web server that is, according to Netcraft, the most widely used web server on the net. In the past when I installed it I found that it just works. It’s self-contained and doesn’t require any additional components, but due to its popularity it’s highly extensible and has plenty of articles, tips, and (most importantly) help available for free.

Installing Apache
Below are the steps I followed to install Apache on my Oracle Cloud based VM. After logging into my VM using SSH as user ubuntu, I entered the following commands:

  1. bash sudo (this made me the root user)
  2. apt install apache2 (this apache downloaded and installed)

Verify that Apache is installed
To check which version of Apache was installed and that it was working, I entered the following commands:

  1. apache2 -v. # (this displays the version (-v) of Apache that has been installed)
    [Click on image for larger view.]
  2. ps-aux | grep apache2. # (this verifies Apache2 is running)
    [Click on image for larger view.]
  3. netstat-anp | apache grep. # (this verified for me that the Apache2 process was listening on port 80)
    [Click on image for larger view.]
  4. apt install lynx. # (this installs Lynx, a text-based web browser)
  5. lynx localhost. # (this starts the Lynx web browser and connects to the localhost)
    [Click on image for larger view.]
  6. I then went to my laptop and tried to access the web server using Chrome. It timed out and failed. I suspected that Oracle Cloud was blocking the port used by Apache (80).
    [Click on image for larger view.]

Open Oracle Cloud Port for Apache
By default, Oracle Cloud blocks all ports to the VMs it hosts, except for the port used by SSH. To allow external connections to your VMs, you will need to open ports to them from the Oracle Cloud Portal. After logging into the portal, I did the following:

  1. I selected Dashboard, widened Calculate and clicked Bodies.
    [Click on image for larger view.]
  2. I selected my instance.
  3. From Instance Information tab, I selected Subnet.
    [Click on image for larger view.]
  4. I selected the security list that showed up.
    [Click on image for larger view.]
  5. I clicked Add an entry rule and opened port 80.
    [Click on image for larger view.]
  6. I checked that the new ingress rule was displayed.
    [Click on image for larger view.]
  7. When I tried again to access the site, it failed.

Open Ubuntu Port for Apache
To allow external connections to my VMs I would also need to open the port on the Ubuntu firewall. From the ubuntu shell I did the following:

  1. I checked that the UFW firewall was not run on entering ufw status
    [Click on image for larger view.]
  2. .

  3. Ubuntu 18.04 also has a kernel-based IP filter, iptables. I listed the allowed ports by typing iptables –list. This showed me that there was no rule to open port 80. To open port 80 and restart the apache server, I entered the following:

    iptables -I INPUT 6 -m state --state NEW -p tcp --dport 80 -j ACCEPT
    netfilter-persistent save
    systemctl restart apache2
          

After opening the port, I went back to my laptop and found that I could connect to the web server.

[Click on image for larger view.]

Summary
I was able to install and access an Apache web server that was running on an Ubuntu VM hosted on Oracle Cloud. It took me a little while to figure out how to open the firewall on Oracle Cloud and then on the VM, but after figuring out what needed to be opened and how to open it, the process was quick.

This “Always Free” Oracle Cloud instance wouldn’t be able to handle a large or complicated website, but that’s not the subject of this article or why Oracle offers this free service. Oracle offers this service to allow people to get their hands dirty with their cloud services, and that’s what I intended to highlight in this article. Although VM creation is only a small aspect of Oracle’s cloud offering, I was impressed with how easy it was to sign up, create, and manage a VM. Hopefully Oracle continues this ease of use with its other cloud services.

See “Using Oracle Cloud, Part 3: Checking Network Performance on Virtual Machines”.

About the Author

Tom Fenton has extensive IT experience gained over the past 25 years in various technologies, with the past 15 years focusing on virtualization and storage. He currently works as Technical Marketing Manager for ControlUp. He previously worked at VMware as a senior course developer, solutions engineer and in the competitive marketing group. He also worked as a Senior Validation Engineer with the Taneja Group, where he led the Validation Service Lab and was instrumental in starting its vSphere Virtual Volumes practice. He’s on Twitter @vDoppler.