Install and run Ghost 1.0+ on a Raspberry Pi

Those of you who have been following my step-by-step guide on how to install and run Ghost on a Raspberry Pi will know that Ghost recently underwent a radical upgrade to version 1.0.

Unfortunately, upgrading existing installs of Ghost hosted on a Raspberry Pi is not so straight forward. At the time of writing, Ghost is not fully supported in terms of installing on a Raspberry Pi but thankfully, has managed to get a test instance up and running and will be documenting the process accordingly.

What you'll need

In my test instance, I used the following:

  1. A Raspberry Pi 2 or 3
  2. Micro SD card (16GB or larger)
  3. Suitable power supply (5V, 2A)
  4. Ethernet cable (more reliable than WiFi)
  5. Appropriate SD card image from below.

What OS?

Now this is where things are a little different. In my previous guide, I used Raspbian Lite as the base image for setting up Ghost on my Raspberry Pi as it allowed me to install the relevant version of Node.js without having to remove the default one bundled with the full Raspbian image.

However, to install Ghost v1.0 and above on Raspberry Pi you need to use Ubuntu, so I opted for the Ubuntu Classic Server 16.04. You can find both of the SD card images on Ubuntu Pi Flavour Maker (although the Pi 2 image has been up and down recently so may not work):

  1. Ubuntu Classic Server 16.04 for the Raspberry Pi 2 (direct link)
  2. Ubuntu Classic Server 16.04 for the Raspberry Pi 3 (direct link)

If the Pi 2 version is not working, then try again at different times. For me, it worked some days but didn't on others, but once you have the image file then keep it safe. I'll explore the option for hosting a mirror here, but I cannot make any promises.

Obviously once you have downloaded the image file, flash it to your SD card. I won't go into detail here as there are countless guides available online on how to do this.

Initial boot

Ubuntu Classic Server 16.04 is a little different to Raspbian but similar in many ways too. To get you started, I highly recommend following these steps:

  1. Connect your Pi to your network via Ethernet cable as this speeds up the initial boot process and you will need to configure WiFi manually once up and running
  2. Create a new user other than the default ubuntu, but you do not need to do this if you don't want to
  3. Secure your Pi by using SSH keys and disabling password authentication. I have this page bookmarked and follow the initial steps relating to generating the necessary key files, as well as this one on what to do next whenever I do this
  4. Update and upgrade your apt packages then install the necessary packages and setup WiFi - to save lots of writing and time, take a look at this fantastically helpful guide from step 4 onwards on what to do here.

You might wonder why you want to setup WiFi if you are going to use your Raspberry Pi hosted Ghost blog via Ethernet, but this step just makes things a lot easier down the road. If you are planning on leaving your Pi hard-wired to your network, then you can skip the WiFi part above.

Install the new Ghost Command Line tool

The guys and gals over at Ghost have done a wonderful job of creating a new command line installer tool, which guides you through the necessary installation steps. To install this on your Raspberry Pi, you will need to do the following:

sudo apt-get update && sudo apt-get upgrade -y  
sudo apt-get install nginx  
sudo ufw allow 'Nginx Full'  
sudo apt-get install mysql-server

The above string of commands will update and upgrade your packages, install Nginx then configure the firewall rules to allow full access for HTTP and HTTPS requests and finally install MySQL Server.

During the MySQL Server install, you will be prompted to input a password for your root user, so make sure you use a strong password but also remember it as you will need it later.

Install Node.js

Next, we'll download and install the latest version of Node.js that is supported by Ghost (v6.9.5 at the time of writing):

curl -sL | sudo -E bash  
sudo apt-get install -y nodejs

Install the Ghost-CLI tool

The last step before we begin the Ghost install process is to install the Ghost Command Line Interface (CLI) tool:

sudo npm i -g [email protected]

This can take a while, so feel free to stretch your legs and grab a drink!

Prepare for the install

The last few steps are similar to my previous guide on installing Ghost on Raspberry Pi, where we created the necessary directories and give them appropriate permissions:

sudo mkdir -p /var/www/ghost  
sudo chown [user]:[user] /var/www/ghost  
cd /var/www/ghost

Remember to substitute [user]:[user] with the user you created in the optional, but recommended step earlier on - i.e. boo:boo.

Kick off the install

Finally, we can now start the install process using the Ghost CLI tool:

ghost install

During the install process, you will be prompted to input various options including:

  1. Your blog's URL
  2. Your MySQL username (root by default)
  3. Your MySQL password (whatever you set it to when you install MySQL Server)
  4. Ghost database name (ghost_production by default)
  5. Whether you want a ghost user
  6. Whether you want to configure Nginx
  7. Whether you want to setup SSL
  8. Setup Systemd so you can start and stop Ghost easily
  9. Whether you want to start Ghost

What next?

If all has gone to plan, you should now have a Ghost blog installed on your Raspberry Pi running at least version 1.0. However, there is still some manual work required in order to access your new blog via any web browser.

In my next guide, I'll be guiding you through how I was able to install and run Ghost 1.0+ on a Raspberry Pi and configure Nginx manually so that I could access my blog via a web browser.

Wesley Archer

Digital Account Manager by day, and maker in his spare time. Also, a regular contributor to The MagPi Magazine for the Raspberry Pi Foundation.

Subscribe to Ghost Pi

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!