My free VPS on Oracle Cloud (tech tutorial)
Because it's only for publishing, my blog is hosted on Cloudflare Pages. However, I found myself wanting to do host some dynamic applications on my domain (to start with, I wanted to share a PHP project). I know forgetting about subscriptions can be expensive, so I saught a crazy price: free. I found one in Oracle Cloud! The process was more complicated than I expected, so here is a tutorial-ish about how you can get one, too.
This guide is written for people who know what a VPS is, have worked with one before, and simply need a free cloud computer for home.
Step 1: Setting up the Oracle account
A quick Google for "oracle cloud free" takes you to https://www.oracle.com/cloud/free/.
Click the "Start for free" button and get going. It's pretty self explanitory, except:
One trick:
- region - you need to pick a "home" region for your server. Your VPS will only be free if it runs in your home region, and not all regions are the same. Oracle's status page helpfully shows which regions have which services, which I take as a proxy for which data centers Oracle is most excited about. I chose US West Phoenix because it was close to my home in the San Francisco area, had almost all of the services, and evidently US West San Jose was super congested.
(optional) Step 2: Upgrade to Pay As You Go
Once you get into your Oracle account, you'll see a banner that invites you to upgrade your account.
It's useful because Oracle will care about your workload more. I had a painful experience before I upgraded, but you can skip this if you want.
The tricks:
- upgrading takes a few hours - you probably can't do anything useful until you get the email that it's
- $100 hold on credit card - you have to provide a credit card, and Oracle will put a $100 hold on it which they'll refund later. For the moment it will look like a $100 charge.
Step 3: Set up your VPS
I wanted a basic PHP host. I went with a 3-core, 18gb RAM ARM VPS which I then configured as a PHP host.
Oracle has two guides which are pretty solid:
- Follow Oracle's Oracle Linux guide for steps 1-3. You want the ARM offering they describe in Step 3 because--for free--you can configure an ARM computer with 4 cores and 24 GB RAM. This is much better than the AMD computer this guide suggests.
- Follow Oracle's Ubuntu guide for steps 3-4 (yes you do step 3 again)
Some tricks:
- Click the detail links in the guide - Oracle hides the step-by-step instructions by default. Click on the links to expand them.
- Pick Ubuntu as your operating system (it's an option in Step 2). I couldn't find a way to change it later, and I'm always frustrated by SELinux in Oracle Linux. You can happily configure a Ubuntu machine on the ARM platform.
- Use ARM - For free, you can configure an ARM computer with 4 cores and 24 GB RAM. When I tried the free AMD computer on the free trial I would only get capacity some of the time. Otherwise I'd just watch SSH hang. It was very frustrating. If you want to use ARM on the free trial (i.e. without converting to Pay As You Go) you might need to use some tricks.
- The estimator estimates it will cost $2/mo - evidently the estimator is broken for ARM even though it's $0/mo. hey_ross on Reddit has an interesting explination about why.
- Networking is hard - My first few attempts at clicking around resulted in a VPS that wasn't accessible from the browser. ChatGPT was no help. The trick was following the "Install a Virtual Cloud Network" instructions.
Step 4: Move into your VPS
My PHP application used some PHP functions that evidently aren't included by default on all PHP installations. I also had to run:
sudo apt install php-pdo
sudo apt install php-xml
sudo apt install php-json
sudo apt install sqlite3
sudo apt install php-sqlite3
Step 5: Configure domain
At this point I had a working PHP server! But I wanted to point a subdomain to it (cloud.srcramer.com).
ChatGPT suggested:
- Log in to Cloudflare and select your domain (
srcramer.com). - Go to the DNS section.
- Click Add Record and configure it as follows:
- Type:
A - Name:
cloud(this sets upcloud.srcramer.com) - IPv4 address: your Oracle Cloud server’s public IPv4 address
- Click Save.
- Type:
It turns out it was this simple!
ChatGPT also suggested disabling proxy because it would avoid Cloudflare interfering with non-HTTP traffic. I decided to keep the proxy enabled and as a bonus it serves the page via HTTPS!
I was also concerned about what would happen if I changed the IP address of my Oracle Cloud VPS. When the DNS is configured like this changes to subdomain IP addresses are instantious, so changing the IP address in the future should result in minimal downtime.
Step 6: Configure a budget
Oracle can email when you've spent $0.50 or $1. Idea Spot on YouTube has a nice tutorial.
One trick:
- Other resources cost money - I was tempted by a one-click Wordpress installation on the Oracle dashboard. It uses a paid VPS (which I terminated) and a paid database (which lives in a different pane and I didn't realize I needed to cancel). If your spending is non-zero but you don't understand why, click around to investigate other resources you may have accidentally configured and deployed.