/ Ghost

How to upgrade your Ghost version

In this post, we'll be looking at how to upgrade your Ghost installation using the command line (Ghost-cli).

Before doing anything else, log in to your Ghost website and navigate to [YOUR DOMAIN]/ghost/#/settings/labs then click the "Export" button. You should see a JSON file start downloading which is a backup file of all your site's data which you will need should the worst happen.

The next thing you'll need to do is make a backup of your content folder. This will mean you will be able to recover your themes and images should the upgrade fail or cause any data loss. To do so: open up a new command line window and connect to your server, then navigate to the root folder of your installation.

Enter the following command (in this example I'm assuming that your Ghost installation is saved at var/www/ghost like mine is but just substitute in your own filepath if it's different.

sudo cp -a content /var/www/ghost-content-backup

Now, if anything happens you have a copy of your content folder outside the root folder of your installation which you can safely restore.

Now, simply enter the comment ghost update and allow the Ghost CLI to perform all of the upgrades to your system. Once finished, you can verify that it has successfully upgraded by checking the latest release number on Ghost's release page and making sure it is the same number you get back when you type ghost version in your command line window. Note that you are looking for the number associated with Ghost Version and not the one for the Ghost-CLI.

You may also need to force the node dependencies to update too, so also type in npm install --production to do so.

Some instances of Ghost 1.x trigger a 502 bad gateway when complete. If you come across that issue, have a look at the guide I wrote here.

Jack Davis

Jack Davis

I am a software engineer from Lincolnshire, UK. I've worked on web-based projects across a number of industries including manufacturing, publishing and education.

Read More