2 min read

How to upgrade Ghost v2 to v4?

How to upgrade Ghost v2 to v4?
Photo by Markus Winkler / Unsplash

Hello guys,

Today I would like to give you an instruction to upgrade Ghost from v2 to v4. Because version 2 is not stable and will not support by the author at the end of this year. So that's why I need to upgrade it.

First of all, you should back up your server data (create a new droplet on the DigitalOcean), backup your database, backup ghost configuration and ghost theme zip file (export data/theme zip in administrator page).In the next step, you should check your MySQL version. If it is v8 then you can ignore step 1.

  1. Upgrade MySQL from 5.7 to 8 (https://tastethelinux.com/2020/09/14/upgrade-mysql-server-from-5-7-to-8-ubuntu-18-04/)

  2. Create a new database

  • mysql -uroot -p
  • CREATE DATABASE <your-database-name>;
  • GRANT ALL PRIVILEGES ON <your-database-name>.* TO '<your-database-username>'@'localhost' IDENTIFIED BY '<your-database-user-password>';
  1. Upgrade nodejs from 8 to 10 (ghost 2@latest works on it)
  1. Upgrade ghost-cli to the latest version
  • sudo npm install -g ghost-cli@latest
  1. Update Ghost to v2@latest
  • ghost update v2
  1. Upgrade nodejs from 10 to 14
  1. Upgrade ghost-cli to the latest version again
  • sudo npm install -g ghost-cli@latest
  1. Upgrade ghost from v2@lastest to v4@latest
  • ghost update --force
  1. Configure your database from old to a new one to ignore conflicts
  • cd <ghost-project-dir>
  • ghost setup
  • You will be asked to fill in data, just focus on database fields.
  • Start the ghost.
  1. Check the blog overview on the browser, now you will see new posts, new designs from Ghost.

  2. You should fix theme issues that come from theme v2 to v4.

  • Upload the theme zip file to the page https://gscan.ghost.org/
  • Check issues, fix it
  • Build zip again (check the package.json commands)
  1. Install theme

Additional steps after fetched the Debian.

  1. Run sudo apt-get install -y nodejs to install Node.js 10.x and npm
  2. You may also need development tools to build native addons:
  • sudo apt-get install gcc g++ make
  1. To install the Yarn package manager, run:

That's all steps that I did it. Hope you get the new experiment with the new version.

Paolo Phan