Installing Ghost

How to host Ghost yourself in the cloud using the AWS free tier

Installing Ghost
Photo by Daniel Jensen / Unsplash

This blog is hosted on the Ghost software platform. Although you can simply sign up to a subscription and use it, you are also able to install it yourself.

Ghost is an open source platform designed to help ease the pain of creating great content and getting it out there for all to see. It's an all in one blogging platform that makes the whole process easy so that the creator can concentrate on their posts and their businesses and not stress about their website.

You can subscribe directly and have your sites hosted for you using Ghost(Pro) or you can do it the hard way! I decided on the latter approach primarily because I was interested in the whole process of installing and maintaining the software. I wanted to try and use AWS - the Amazon Cloud - to host the web server on a budget. I wanted the server to run in the free tier so that prospective users could try it out for free.

Things looked hopeful since the Ghost website says:

The fastest way to get started is to set up a site on Ghost(Pro). If you're running a self-hosted instance, we strongly recommend an Ubuntu server with at least 1GB of memory to run Ghost.

The free tier Ubuntu server on AWS has 1GB of memory and up to 30GB of disk so seemed to fit the bill. What could possibly go wrong?

I setup a free one year trial of AWS to provide me with my Ubuntu server in the cloud. I kept everything very simple. I created an Ubuntu server instance. AWS created a key pair for ssh access to the server and I locked access down so that only my current IP address could access the server on the ssh port. I also opened the https port to the world. I then associated an elastic IP address to the server instance so that I had a public IP address to point to my new blog website.

I created a sub domain to serve my new blog and added my new IP address to point to the sub domain. I had originally decided to use Cloudflare to provide an SSL certificate for the domain primarily because there would be no cost. I used this video to help with the SSL certificate setup. However, this wasn't really necessary because the Ghost installation script deals with the creation of an SSL certificate automatically using Let's Encrypt.

I used putty to connect to my new server and then followed the installation instructions on the Ghost website. Everything seemed to work OK until the final ghost install command. Unfortunately this never completed. It got stuck while installing dependencies.

A bit of searching on the internet seemed to confirm that the installation had failed because the server had run out of RAM. Most reports I found implied that the server needed 2GB of memory. This was a problem because 2GB wasn't possible within the AWS free tier. A quick search of AMI templates in AWS which provided the Ghost platform didn't have any in the free tier. They all had 2GB servers. This wasn't looking good.

Luckily I found a comment in one of the forums that suggested the installation would work if the 1GB server had some swap space. So I used this article to add 1GB of swap space to the 1GB server. I then successfully repeated the installation with no issues. Yay!

Now I need to figure out how to use Ghost and how to play around with the website design. That might take a while.

Since installing Ghost for the first time, I've refined the process and documented how to install Ghost on AWS and how to create backups. I'll link all future Ghost blog posts below.

Installing Ghost on AWS
Ghost on AWS Backup Strategy