How to install Ghost, the professional blogging software

Although there's some very good instructions on how to install Ghost on the official site (https://docs.ghost.org/v1.0.0/docs/cli-install) they are a little long winded and can be reduced by ignoring most of the explanation.

This guide assumes you want to be installing Ghost into a production environment.

Prerequisites

Ghost is fairly simple to install, though it can only be installed on Ubuntu 16.04. So make sure you have that in place. You'll also need more than 1GB or RAM, or available swap space to run the install.

The other prerequisites are Nginx, MySql-Server and Nodejs.

sudo apt install nginx mysql-server
MySql-Server will require an admin password, type it in twice and remember it - you'll need it later.

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash
sudo apt install -y nodejs
sudo npm i -g ghost-cli
These three lines install the correct version of NodeJS, and then install the ghost-cli - which is used for the heavy lifting in the install.

sudo ufw allow 'Nginx Full'
This line opens up the firewall for Nginx, so that you can actually get to your site.

The install

Now that the prerequisites are out of the way, you can actually get on with installing ghost. First make a ghost directory
sudo mkdir /var/www/ghost

Then from within that directory run the installer
cd /var/www/ghost
ghost install

The installer will take you through several prompts which will configure and install Ghost onto the prerequisites we ran through earlier. Full instructions on these prompts can be found here

The compressed install

If you're rushed for time, the following code block will go off and download and install all the prerequisites for you, setup the directory and kickoff the install. The only intervention required will be for the MySQL password, and to answer the Ghost prompts.

apt update && apt upgrade -y
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash
sudo apt install -y nodejs nginx mysql-server
sudo npm i -g ghost-cli
sudo ufw allow 'Nginx Full'
sudo mkdir /var/www/ghost
cd /var/www/ghost
ghost install

Finally

After all of this, simply head over to your blog to make sure that it's working, if it loads make your way to yoursite.com/ghost and login for the first time.

Happy blogging!