How to Update Ghost on Digital Ocean Droplet

ghost Oct 17, 2021

Ok, a few months pass by and you get a notification like this from Ghost:

Ghost Update Message

It's time to update your Ghost installation. It kinda sucks, but you have to do it, the only alternative is to use Ghost Pro

If you don't know which version of Ghost you're using, you can go here on your dashboard:

Click the Arrow next to your name:

Then click About Ghost:

As you can see above, am running Version 3.39.0 of Ghost.

I would like to update all the way to 3.42.1 and eventually to version 4.0 which is the current version.

Please Note:

Ghost doesn't allow you to update straight from your old version of version 3 straight to version 4. So let's say I have version 3.5 on my system, before updating to version 4.o, I will need first to get to the most recent version of version 3, which can be maybe 3.9 ...then from there I can update from 3.9 to 4. (I hope that's clear!)

That's why you see on my screen, I need to update to 3.42.1 from 3.39.0.

3.42.1 was the latest version of version 3. From there I will update straight to whatever version of version 4 is.

Also the following screenshot may be useful:

Major Ghost Releases

Okay, I use Digital Ocean for my Ghost Hosting and I pay about $6 per month ($5 - Hosting + $1 - Backup).

If you just got into blogging and you wanna know how you can use Digital Ocean with Ghost, please visit this blog post on how to install Ghost on Digital Ocean

Update Ghost on Digital Ocean

After the above rumbling, now back to business.

Muy importante: It's highly recommended to have a full backup of your site before doing any major updates. If anything breaks, you will still have your website.

I use Windows Powershell as my Command Line tool to do the update, but you can pick whichever Command Line tool works for you.

So after opening Powershell, put the following command: ssh [email protected] followed by the IP address of your droplet, just like you see below.

ssh [email protected]

Please replace that IP address with your own.

So here it's how it looks from Powershell:

Press ENTER on your keyboard, You may get the following message:

Type yes, just like you see above and then press ENTER

At this point enter the password for your droplet:

Please note you won't be seeing the characters as you're entering your password.

When you succeeded on entering the password, you will see a bunch of welcome screen message, and also you will see the following:

Now you're already in your droplet and you can update it.

Type the following command to enter to the Ghost CLI:

 sudo -i -u ghost-mgr
Switch to the ghost-mgr user to manage Ghost using CLI

After after you should see something like this:

Now we need to navigate to the Ghost installation folder:

Type the following command:

cd /var/www/ghost

On my window it looks like this:

Now you will be directed to the Ghost installation folder like you see below:



Now this is the point where things can get a bit tricky or you may start seeing some errors:

Install and Update NodeJS

To avoid those errors, let's first update NodeJS by install the new Node version by running the following command:

sudo apt update
This command refresh your local package

Then install the new version of Node JS by typing the following command:

sudo apt install nodejs
Command to Install NodeJS

Confirm the new version of NodeJS is installed by typing the following command

node -v
Check NodeJS version number

The above command should output the most recent version of NodeJS which for me as of today is Version 10.24.1

Install and Update NPM (Node Package Manager)

After updating NodeJS, let's now update your version, by running the following command

sudo npm install -g npm
Command to Update and Install NPM

Install and Update Ghost CLI (Command Line Interface)

Then let's update Ghost CLI, by typing the following command:

sudo npm install -g [email protected]
Command to install and update Ghost CLI

Run the Ghost Update

Now is the time to run the Ghost update command. Remember when I told you you can't just go from a major version in this case version 4  without first updating to the latest minor version of 3.

So first I will update Ghost to the latest version of 3 by running the following command:

ghost update v3
Updating Ghost to the Current Version 3

In Powershell it looks like this:

It will take a few seconds,

Then you may get this error:

Error Updating Ghost

Don't worry, it seems the Node update we did previously is not compatible with our updated version of Ghost, which is 3.42.9

So we will need to go back just a few versions back. Let's go to Node version 14.15.0 by typing the following command first:

sudo npm install -g n
This will install the n module

Then let's install Node version 14.15.0

sudo n 14.15.0
Reverting to an older version of NodeJS

Now let's run the Ghost update again, by typing the following command:

ghost update v3

Ghost Version 4 Update

Version 4 of Ghost requires MySQL database version 8. So let's check which version of MySQL is installed in our system by typing the following command:

sudo mysql
To enter to MySQL Command Line Interface
MySQL Console

When in MySQL console type the following command:

select @@version;

You should see this:

Version 5.7.37 of MySQL

As you can see above...we're running MySQL version 5.7.37

Let's get out of MySQL console by hitting CTRL + D (On Windows)

Then type the following command:

sudo apt-get update

After typing that command, you may get this error:

Error updating package list

If you see the error above:

It means that you still have an older version of the GPG key used to sign Yarn releases. The expiry date for this key was extended from 2020 to 2021. To get the updated key, run this:
curl -sS | sudo apt-key add -

That should solve the problem.

Again, we will try to update our package list by typing the followin command:

sudo apt-get update
Update Package List

Update MySQL

So first get out of MySQL Command Line by hitting CTRL + D (On Windows)

Then type the following command:


The above command will add MySQL APT repository to your system’s software repository list.

Then type the following command:

sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
Command to Install MySQL 

The above command should show you the following prompts:

MySQL COnfiguration Window

Click the first option by hitting ENTER on your keyboard. You should see the following window:

MySQL Configuration Window

Using your arrow keys, select the second option: MySQL-8.0 and hit ENTER on your keyboard

Then you will see the following window:

MySQL Configuration window

Use your arrows keys again to select the forth option: Ok ...just as you see below:

Then click ENTER on your keyboard. If everything goes well! MySQL 8 should start installing. Otherwise, you will get the following errors just like I did. And this is how to correct them

First error: Warning

Warning Message

You can solve that warning error by using the following commands:

sudo apt remove mysql-apt-config

Then after solving that problem put the following commands:


Then put the following command:

sudo apt install ./mysql-apt-config_0.8.15-1_all.deb 
Another Error

Now we have two errors: As it turns out, we still have the original error about the warning, and now we have another message indicating that _apt user doesn't have write permission.

We can solve that problem by running:

sudo chown -Rv _apt:root /var/cache/apt/archives/partial/

Then this:

sudo chmod -Rv 700 /var/cache/apt/archives/partial/

Now let's run again this command:

sudo apt install ./mysql-apt-config_0.8.15-1_all.deb

After that commands run you may be prompted to do an auto remove of some can follow the prompt and do that. I believe it's optional.

Anyway, then let's do this:

sudo sed -i  "s/jessie/buster/g" /etc/apt/sources.list.d/mysql.list

Then this:

sudo apt update

After that you may get another error, such as:

Public Key Error

Solve that error by copying that public key then appending it at the end of the following command, just like this:

sudo apt-key adv --keyserver --recv-keys 467B942D3A79BD29

That should solve the problem.

Now am going to put the following commands in order, they should all work now:

sudo apt install ./mysql-apt-config_0.8.15-1_all.deb 


sudo sed -i  "s/jessie/buster/g" /etc/apt/sources.list.d/mysql.list


sudo apt update

Now the big command of installing MySQL Server:

sudo apt install mysql-server 

That should take a few seconds...

After it's done, run the last command:

sudo service mysql start


Now after so many errors, MySQL 8 is installed on your system. You can confirm by doing the following:


Then you should see on the screen the new version of MySQL: Server version: 8.0.28 MySQL Community Server - GPL

Ghost Version 4

Make sure you are on the Ghost CLI manager:

sudo -i -u ghost-mgr
ghost-mgr user

And then you are on the following directory:

cd /var/www/ghost
Ghost Directory

Confirm the version of Ghost installed in your system by:

ghost version
Ghost Version Command

Once you see the system installed, in my case it was: Ghost version: 3.8.0 (at /var/www/ghost)ghost$



Major Ghost Update (Ghost Version 4)

You may need to update to the current version of NodeJS by doing the following command:

sudo n 16.14.2

The current version of NodeJS as of writing this is: 16.14.2 replace that version number with the version of NodeJS you want.

Now do the major update by running the following command:

ghost update

That will get us to the most recent version of Ghost which as of writing is version 4.19

In the process you may be asked to check for theme compatibility, to which just agree Y (yes), and also go ahead to agreeing when asked if you wanna go ahead and install the recent version of Ghost.

That's it! Till next year. I normally do this work once a year...




Ami Amigo

Ami Amigo (pseudonym) is one of the main contributors to this blog. He is a tech aficionado, developer, blogger and an online instructor. Ami Amigo studied Computer Science and Philosophy in college

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.