This is Part 2 of my tutorial in creating a Ghost Blog for free on GCP. If you haven't read part 1, here is the link.

Now, to continue, the first part was a tutorial on how to create your own VM Instance for FREE on Google Cloud Platform. We created a f1-micro instance with 30GB of hard disk space in part 1. Now in part 2, we will learn how to configure your VM Instance to host the Ghost Blog application.

First, go to the Compute Engine page where you will see all the instances you have running.

You can see the table of all your VM Instances running. Select the one you want to run and click the button which says 'SSH' under 'Connect'.

You should see one window pop up, it will take awhile to load. After it has loaded, you should see this page. You are now in the Ubuntu operating system! You may be shocked, why isn't there any UI like the operating system I am using right now? Ubuntu is a server operating system that is meant to be ran on servers. Therefore, there is no GUI pre-installed but you can install a GUI if you prefer using one.

For this tutorial, we will be using the CLI commands to navigate the operating system to install our very own Ghost Blog!

If you followed this tutorial closely, you will see the specifications of our VM Instance. If you don't remember, here are the specifications:

We are using the f1-micro instance which has the following specifications:
- Micro machine type with 0.2 vCPU
- 0.60 GB of system memory
- backed by a shared physical core.

You can find out more about different specifications of the different types of instances here.

If you know a little about computer specifications, 0.6GB of system memory (also known as RAM)? That is barely enough to run a Windows operating system! But Ubuntu runs just fine on this. That is why Google Cloud has this free tier which allows us to run our small projects such as this Ghost Blog for free!

On the Ghost Blog website, it is recommended that we add 'Swap Memory' if our system memory is below 1GB. You can do that by entering these commands on our Ubuntu CLI.

dd if=/dev/zero of=/var/swap bs=1k count=1024k
mkswap /var/swap
swapon /var/swap
echo '/var/swap swap swap defaults 0 0' >> /etc/fstab

Next, we will be installing the Ghost CLI on our VM Instance, also known as server, for production purposes, which means your blog will be LIVE on the internet!

Server Setup

Now we will be doing the server setup for our Ghost Blog. Ensure that you are in the root user by entering:

sudo su

You should see that the user on the left of the console has changed from my username 'yuehernkan' to 'root'. This means that you are logged in as the root user and can do modifications to the system.

Step 1: Create a new user

adduser <username> 

You will be prompted to enter your 'UNIX password' which is the password for you to login to this particular user. Enter a simple one that you can remember. If nothing appears as you type, do not panic! This is intentional, the characters will not appear as you type. So please enter it carefully. If you think you mis-typed a character, just hold backspace for around 5 seconds to delete all the characters and type it in again.

You will be asked for details such as Full Name, Room Number, etc. Just leave them as default by pressing the Enter key. After it asks if the information is correct, press Y and ENTER. The new user will be created. There will not be a message like 'User created successfully'.

You can confirm that the user has been created by doing:

su <username>

You should see that the user 'root' has changed to the username you entered when you created the user. In this case the user I created is called 'ghost' so the green portion will be changed to 'ghost' which indicated the current user that is logged in.