Make Gadgets Work

Update Ghost on Fedora

Ankit Mittal

While the guidance on Ghost website is very clear, I did get issues that required steps in troubleshooting. Something to do with lodash and npm version 2 stuff (node_modules/knex requires lodash@'^3.7.0') that I read on one of the forums specifically the comment from ErisDS on 13/06.

Anyway, reading this I deleted node_modules followed by npm install and it worked. All commands in order as I did are listed below. If my previous posts were used to create the blog nothing here will require sudo or root privileges.

As before all this was done on Fedora 24 Linux OS and following commands will need to be changed where it mentions yoursite and username. If the path is different then obviously entire path needs to be replaced.

#Copy the entire site as backup. It will be a verbose copy an all access rights will be preserved. 
cp -avr /var/www/html/yoursite /home/<username>/

#Now in the site directory create a directory ghostlatest
mkdir /var/www/html/yoursite/ghostlatest

#change directory to ghostlatest
cd /var/www/html/yoursite/ghostlatest

#now download the latest ghost zip file
curl -LOk

#unzip the downloaded file

#stop your Ghost instance (assuming Ghost is the alias
#created as per my previous post else replace with 
#whatever alias was used with pm2). 
pm2 stop Ghost

#change directory and delete old folders and files
cd /var/www/html/yoursite
rm -rf core
rm -rf index.js
rm -rf *.md
rm -rf *.json
rm -rf /var/www/html/yoursite/content/themes/casper

#remove node_modules because anyway the lodash issue will hit later on.
rm -rf node_modules

#copy from ghost latest to site directory new folders
cp -avr /var/www/html/yoursite/ghostlatest/core /var/www/html/yoursite
cp -avr /var/www/html/yoursite/ghostlatest/index.js /var/www/html/yoursite
cp -avr /var/www/html/yoursite/ghostlatest/*.md /var/www/html/yoursite
cp -avr /var/www/html/yoursite/ghostlatest/*.json /var/www/html/yoursite

#optional if you haven't made customisation to default theme.
cp -avr /var/www/html/yoursite/ghostlatest/content/themes/casper /var/www/html/yoursite/content/themes

#Install Latest Version
npm cache clean
npm update
npm install --production

#Start to update dependencies
npm start --production

#Once above command is complete, stop the server and restart using pm2
pm2 start Ghost