How to update Ghost 3.x on Ubuntu 18.04 LTS
Introduction
My Ghost blog that was set up by the DigitalOcean 1-click installation failed to update a few times in 2019-2020. I was able to revert the failure using a backup image of my server.
Here is how to update and make sure that it will not fail. Follow these instructions as root
or with sudo
. The key is to have all the correct dependencies installed and up-to-date.
Backup
Before updating your Ghost blog, it is a good idea to download backups of your content. Visit your Ghost Admin > Labs > Export Content. You may also want to download your image and theme directory using SFTP.
Check Dependencies
- Check your Node version:
node -v
- If your Node version is not
v12.x.x
(Node v12 Erbium LTS), follow the instructions to upgrade Node.
Steps
- Update the Ubuntu dependencies:
sudo apt-get update && sudo apt-get dist-upgrade -y
- Update npm:
sudo npm install -g npm@latest
- Update the Ghost-cli:
sudo npm install -g ghost-cli@latest
- Change user to
ghost-mgr
:sudo -i -u ghost-mgr
- Change directory to Ghost installation:
cd /var/www/ghost
- Run
ghost doctor
and fix anything that needs to be fixed:ghost doctor
- Update Ghost:
ghost update