I've been running Ghost for quite a while now and have found it to be a great platform for my occasional blogging. It now time to upgrade to the lastest available version as I have been running the initial version since release. Below are the steps required to complete this upgrade process on a Linux self hosted Ghost install (Debian).
Back up existing content
Our first step is to ensure that we back up all our existing content, which turns out to be a pretty simple task due to how Ghost stores content. You can also use a point and click backup via the ghost admin UI which is explained here but I prefer to do it at the command line and will script and automate it in a later post.
Before backing up you must stop our Ghost server in order to avoid issues whilst taking your back up.
# su ghost
# cd /var/www/ghost/blog.apericore/htdocs
# forever stop index.js
I've installed Ghost to
/var/www/ghost/blog.apericore/htdocs so you can replace that with your own location.
Now that Ghost is stopped we can go ahead with the content backup which is a simple copy of the content directory under the root Ghost install directory above:
# sudo tar -cvpzf /var/backups/ghost-backup-20140711.tar.gz content/
Upgrade to latest version of Ghost
We now have a back up of our content so can continue with the upgrade confident that we can recover from any problems during the upgrade!
Grab the latest version of Ghost:
# mkdir /tmp/ghost
# cd /tmp/ghost
# wget https://ghost.org/zip/ghost-0.4.2.zip --no-check-certificate
# unzip ghost-0.4.2.zip
Upgrading the software now involves copying and replacing some files as explained in the Ghost upgrade documentation. Below are the commands I used (remember I am currently in the /tmp/ghost directory and my ghost installation root is /var/www/ghost/blog.apericore/htdocs):
# cp *.js *.json *.md LICENSE /var/www/ghost/blog.apericore/htdocs/
# rm -rf /var/www/ghost/blog.apericore/htdocs/core/
# cp -R core /var/www/ghost/blog.apericore/htdocs/core/
# cp -R content/themes/casper /var/www/ghost/blog.apericore/htdocs/content/themes/
# cd /var/www/ghost/blog.apericore/htdocs/
# npm install —production
The latest version of Ghost is now installed and we can restart the service:
# su ghost
# NODE_ENV=production forever start index.js
I'll follow up with a post about the new features and improvements.
* Update Jan 2017 - I've now moved to using Ghosts hosted platform rather than running it myself. So far its been excellent and well worth the fee.