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 experiment to use an âalways freeâ Ubuntu 18.04 VM on Oracle Cloud to host a small website.
In a previous article, I explained that it takes less than 10 minutes to register, create, and use an âalways-freeâ Ubuntu 18.04 virtual machine (VM) on Oracle Cloud. Yes, the free VM was not that big (1 vCPU and 4GB RAM), but I figured it would allow the creation of a small website – a good test of Oracle Cloud because the website on the virtual machine would need to open to allow access to the outside world. In this article, I will discuss which web server I chose to use, how I installed it, and how well it works.
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 with the outside world.
Apache is a free open source web server which is, according to Netcraft, the most used web server on the net. In the past, when I installed it, I found that it just worked. It’s stand-alone and doesn’t require any additional components, but due to its popularity, it’s highly expandable and has plenty of articles, tips, and (most importantly) free help.
Below are the steps I followed to install Apache on my Oracle Cloud based VM. After logging into my VM using SSH as a user Ubuntu, I entered the following commands:
- sudo bash (that makes me the root user)
- apt install apache2 (this downloaded and installed Apache)
Check that Apache is installed
To check which version of Apache was installed and working, I entered the following commands:
- apache2 -v. # (this displays the version (-v) of Apache which has been installed)
- ps-aux | grep apache2. # (this checks that Apache2 is running)
- netstat -anp | grep apache. # (this verified for me that the Apache2 process was listening on port 80)
- apt install lynx. # (this installs Lynx, a text-based web browser)
- lynx localhost. # (this starts the Lynx web browser and connects to the local host)
- I then went to my laptop and tried to access the web server using Chrome. It expired and failed. I suspected that Oracle Cloud was blocking the port used by Apache (80).
Opening the Oracle Cloud Port for Apache
By default, Oracle Cloud blocks all ports to the virtual machines it hosts, except the port used by SSH. To allow external connections to your virtual machines, you will need to open the ports from the Oracle Cloud portal. After logging into the portal, I performed the following operations:
- I selected Dashboard, expanded Calculate and clicked Instances.
- I have selected my instance.
- Of Instance Information tab, I selected Subnet.
- I selected the security list that was displayed.
- I clicked Add entry rule and opened port 80.
- I checked that the new entry rule was displayed.
- When I tried to access the site again, it failed.
Opening the Ubuntu port for Apache
To allow external connections to my virtual machines, I would also have to open the port on the Ubuntu firewall. From the Ubuntu shell, I did the following:
- I checked that the UFW firewall was not run on entering ufw status
Ubuntu 18.04 also has a kernel based IP filter, iptables. I have listed the authorized ports when entering 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.
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 would not be able to handle a large or complicated website, but that is not the subject of this article or the reason 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. While VM creation is only a small aspect of Oracle’s cloud offering, I was impressed with the ease of registering, creating, and managing a VM. Hopefully Oracle continues this ease of use with its other cloud services.
Tom Fenton has extensive hands-on IT experience gained over the past 25 years in various technologies, with the past 15 years focusing on virtualization and storage. He is currently working as a technical marketing manager for ControlUp. Previously, he 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 his vSphere Virtual Volumes practice. He’s on Twitter @vDoppler.