How to Update Ghost on a Digital Ocean Droplet

This guide covers my process for updating my Ghost CMS sites on a Digital Ocean Droplet.

How to Update Ghost on a Digital Ocean Droplet
Photo by Roland Larsson / Unsplash

This post contains my SOP for updating the Ghost sites that I have running on Digital Ocean. I've been using this process for a few years now and find it to be helpful since it has all of the commands I need.

What this guide covers:

  • Updating Ghost CMS
  • On Ubuntu
  • Hosting on a Digitial Ocean Droplet
💡
If you're not using Ghost yet, here's a referral link that will give you a $200 credit to try DO: https://m.do.co/c/9eddeec70472

Step 1: Access the Server

Login to the server as root. You can do that with SSH or simply press the console button on the right of the Droplet's header. This button will open up a console window logged in as root.

Droplet Header

Step 2: Update the server

💾
Backup Time: Make sure you have a recent backup of your server. Setup backups

Make sure you are root:

sudo su

Run the following commands:

# Update package lists
sudo apt-get update

# Update installed packages
sudo apt-get upgrade

Update Node if needed by following this guide.

Update Ghost CLI:

npm install -g ghost-cli@latest

If needed, restart using:

sudo reboot

Update Ghost Installations

Change to ghost manager user:

sudo -i -u ghost-mgr

Change to the directory you want to update:

cd /var/www && ls

Pick which one you want to update. Directory name ghost is the default name, but yours may be different. If there are multiple Ghost sites on this server you will want to complete this step for each of them.

Change into the directory of the ghost install you want to manage using cd directory_name.

Optionally check to see if an update is available by running:

ghost check-update

Make a backup of the ghost site in case something bad happens (should probably backup all the sites on the server before updating). Before making the backup, make sure to make note of your administrator email and password as it's required to make the backup:

ghost backup
💾
Backup Time: Make sure to backup your site before proceeding.

Run ghost update to update the site 🤞:

ghost update
💡
Now is a good time to make sure you're not saving unnecessary Ghost backups. To check, enter the ls command then use the rm command to delete the old files (probably a good idea to keep the one you created a few moments ago).

Finally, check to make sure the site loads by opening it in a private tab (to avoid caches) and navigating some in the Ghost dashboard.

You've done it! Now, make sure to complete this process regularly to ensure that your site stays up to date with the latest features and security patches.