Updating ghost at the press of a key
####### You run your own ghost blog in your own server, find it difficult to update to newer version, then you reached the right page
The upgrade is done in 4 easy steps,
Note: $1 represents the path to ghost installed directory
Step 1: Download the latest release of ghost, extract and change directory to ghost-latest
# $1 - path to the ghost blog installation directory
wget https://ghost.org/zip/ghost-latest.zip
unzip ghost-latest.zip -d ghost-latest
echo "Downloaded latest ghost package"
rm ghost-latest.zip
#run installation from latest ghost installation files directory
cd ghost-latest
Step 2: Back up your current blog's data, copy entire folder from install directory to backup directory
echo "Backing up existing site to $1-bk"
cp $1 -R $1-bk
Step 3: Copy new files from ghost-latest directory to the install directory
echo "copying new files to installation directory $1"
cp index.js $1
cp package.json $1
cp -R core $1
Step 4: Remove the ghost-latest directory as we have copied the latest files to install directory in the previous step. Then navigate to installation directory and start npm install
in production mode
cd ..
rm ghost-latest -r
cd $1
npm install --production
With all four steps combined,
# $1 - path to the ghost blog installation directory
wget https://ghost.org/zip/ghost-latest.zip
unzip ghost-latest.zip -d ghost-latest
echo "Downloaded latest ghost package"
rm ghost-latest.zip
cd ghost-latest
echo "Backing up existing site to $1-bk"
cp $1 -R $1-bk
echo "copying new files to installation directory $1"
cp index.js $1
cp package.json $1
cp -R core $1
cd ..
rm ghost-latest -r
cd $1
npm install --production
click here to download the script
in your terminal execute the script like,
sudo bash upgrade-ghost.sh "[PATH TO GHOST INSTALLED DIRECTORY]"
If you want to create a permanent script with the installer configured to specific ghost installed path, then replace $1 with the path to ghost installed directory and save the script. Then you just have to enter the following in the terminal
sudo bash upgrade-ghost.sh