How to update your Ghost blog

Hi,

Last post I made a March todo and I had to update my Ghost installation. Actually each time I was logged in into my admin panel a newest version was out and it asked me to update my version of Ghost. This is what I have done and I will show you how to do it in this post.

First of all my fresh new Ghost blog installation was coming from a Docker Installation from Scaleway Imagehub. Yes I hosted it over there :). So from this I had the following version of Ghost:
Ghost version: 0.7.1
Hosted on a cloud instance with a Ubuntu 14.04.

Requirements:

  • A terminal with ssh and a public key or credentials in order to be connected to your server/instance
  • Patience

I updated it in 30minutes and it was quite easy I mainly followed the following instructions available here:
http://support.ghost.org/how-to-upgrade/

The following is pretty much the same thing from the link bellow, however there will be some differences according to my installation. It's up to you to follow one or another. Actually it's just like a recipe where there is always some tips and tricks and I also had to do few more things that's why I am rewriting some part of the upgrade.

Backup your installation

1.Go to https://my-blog-url.com/ghost
2.Go to Lab section
3.Click on export button

You will get a .json file where all of articles and settings will be saved. In this section you also have the opportunity to import all of your datas and settings while uploading a previously saved backup .json file.

4.Rather than removing files from your current installation, I recommend you to move them into a backup folder.

Create a backup folder mkdir /home/backup-ghost somewhere. Based on a installation from /var/www see the following instructions.

cd /var/www
mv -R core/ /home/backup-ghost
mv -R node_modules/ /home/backup-ghost
mv index.js *.md *.json /home/backup-ghost

I had to move my node_modules folder and then reinstall them since I had issues with some dependencies.

I am also using yarn to deals with my nodejs package dependencies, so you will then have to make yarn install or npm install and it will do the rest.

In order to deal with my installed versions of node I am using n npm module.

Getting last version of node like this n stable. However when I did this I notice that Ghost was not supporting the last version of node see this: http://support.ghost.org/supported-node-versions/

So you can install a specific version like this:
n node_version eg: n 6.9

If you have multiple version installed you can select one, and then check if everything is ok like this node -v.

Get the latest version of Ghost

5.Create a directory mkdir ghost-backup && cd ghost-backup
6.Get the latest version of Ghost
curl -LOk https://ghost.org/zip/ghost-latest.zip OR a specific version one
curl -LOk https://ghost.org/zip/ghost-<version>.zip
If you don't have curl you can install it obviously apt-get install curl
7.Unzip file unzip ghost-latest.zip -d ghost-temp && cd ghost-temp

Update your ghost installation

8.cp -R core /var/www
9.cp index.js *.json /var/www
Optionally if you are running casper theme you can also update it:
cp -R content/themes/casper /var/www/content/themes

Check your installation

10.Restart your ghost service + nginx
On scaleway instance they are using supervisor so you can restart ghost service like this:
supervisorctl restart ghost

If you are using forever or pm2 restart the service according to those process manager.
For nginx nginx restart

If you have no error, your installation should be updated and up and running.