If you're struggling to update your Ghost server on DigitalOcean, you're not alone. Alternatives like Wordpress come packaged with a web-based updating tool, but Ghost doesn't so you're going to have to get a little down and dirty with your server using CLI to upgrade your Ghost instance to the latest version.

Checking for updates

Checking to see if an update is available is relatively easy. Go to the Ghost control panel, login and click on your username (bottom left) and then About Ghost.

The about screen should lsit your current version, along with any available upgrades and a link to some woefully inadequate instructions.

One thing to take note of, is that if you're using a custom theme on your site, you can 'pre-check' its compatibility with the latest version of Ghost by using this tool.

In order to do so, download your current theme (or the latest version if you need to update that too), and upload it as a ZIP file to the tool. It will then be checked for compatibility with the latest version of Ghost.

Updating

Having checked your theme for compatibility, it's on with the update.

  • Connect to your server via SSH/local console.
  • Backup your content as per the Ghost update instructions above, or ensure you have a backup of your own via another method, just in case.
  • Update your ghost binaries with the following command:
sudo npm install -g ghost-cli@latest

The command above merely ensures that you're using the latest version of the 'ghost' command set. This is the command you'll run to upgrade your site, it is not the actual upgrade, and won't make any difference to your website.

  • Switch user to the ghost-mgr account. Digital Ocean installs ghost using a local service account on your server. You need to run the upgrade as that user:
su ghost-mgr

Your CLI session is now running as the ghost-mgr user.

  • Change directory to your ghost installation folder.
cd /var/www/ghost

You must run the Ghost upgrade from within the installation folder. This is how the Ghost updater knows which instance to update (you could theoritcally have multiple instances running on a single web server).

  • Upgrade your ghost installation.
ghost update

The upgrade should now run - it will pre-check for any problems, and automatically try to remediate any problems that occur.

  • Read the on-screen log when the upgrade completes/fails.

The output shown at the end of the process will indicate whether or not the upgrade has succeeded. If it fails, Ghost is pretty good at telling you why, and usually offers a remediation suggestion that will allow you to fix the issue, so READ THE LOG!

  • Logout of the ghost-mgr user.
exit

This will take you back to your normal SSH/console user. If your upgrade is complete, you can now type 'logout' to exit your SSH session completely.