How To Upgrade Ghost From 0.7 to Ghost 0.8
Ghost has been released for a couple of days.
Ghost 0.8.0 contains a major database upgrade, some breaking changes to the theme API and several new features for you to test out.
My favourite feature is subscriber feature which can collect email addresses from ghost blog and theme API changes.
Now, Let's talk about how to upgrade ghost from 0.7 to ghost 0.8.
Make a Backup
first things first, you should make a copy of ghost in case something unpredictable happens.
Use the export tool on the labs page to create a
.json file and make copy of the
content folder in the root of your Ghost install – this contains your images and themes.
also make a backup of
cp config.js config.js.backup
Fetch latest ghost zip
wget https://ghost.org/zip/ghost-latest.zip unzip ghost-0.8.0.zip -d ghost-0.8.0
Delete Old Files
Navigate to ghost installation path, delete
*.js not include
Copy New Files
core directory from your newly downloaded latest version of Ghost. Also be sure to copy & replace
npm-shrinkwrap.json – getting the latest copies of these 3 files is critical to the upgrade completing successfully.
You may also want to copy over the latest versions of the .md files like README.md or PRIVACY.md so you have them to hand as these contain useful info.
If you’re using Casper – the default theme – without modifications then you’ll also want to copy the content/themes/casper folder from the latest version into place in your install directory.
cp -R path-to-unzipped-ghost-folder/content/themes/casper path-to-ghost-install/content/themes
chown -R ghost:ghost /path-to-ghost-install/
inside ghost installation directory run:
npm install --production
This step needs to complete successfully without errors (warnings are OK) for the next step to work. If anything goes wrong there will be details in a file called npm-debug.log. The first thing to try if this step fails is always to remove the node_modules folder, run npm cache clean and try again.
This is the moment of truth! For most upgrades, just restarting using your restart command at this point should be fine.
Sometimes Ghost will perform update tasks on the first start after an upgrade. If you aren’t confident you know where to find your logs, it may help to run the first start on the command line. To do this, run your stop command, and then run
npm start --production. Ghost will output information about what it is doing, and tell you when it is done.
Once this is complete, press
ctrl+c to exit and use your normal start command to get Ghost running normally again.
- Get the latest version:
curl -LOk https://ghost.org/zip/ghost-latest.zip`
- Unzip to a temporary location:
unzip ghost-latest.zip -d ghost-temp
- Change directory into your current ghost install:
cd path-to-ghost-install, E.g. cd /var/www/ghost
- Remove the core directory completely:
rm -rf core
- Change back to your download of Ghost latest:
cd path-to-ghost-temp E.g. cd ~/Downloads/ghost-temp
- Copy the new core directory to your Ghost install:
cp -R core path-to-ghost-install
- Copy the other key files to your Ghost install directory:
cp index.js *.json path-to-ghost-install
- (optional) Update Casper by copying the casper folder:
cp -R content/themes/casper path-to-ghost-install/content/themes
- Change back to your ghost install directory:
- Update permissions:
E.g. chown -R ghost:ghost *
- Upgrade dependencies:
npm install --production
- Restart Ghost
E.g. service restart ghost or forever restart index.js or pm2 restart ghost or npm start --production