Upgrading Ghost to the latest version
Keeping Ghost installation up-to-date is important not only because of new features added but also because of all the security updates.
Keeping Ghost installation up-to-date is important not only because of new features added but also because of all the security updates.
1. BACKUP /var/www/ghost/content folder
* optional but highly recommended
2. sudo systemctl stop ghost
* or any other service manager
3. cd /var/www
* assuming the blog is located at /var/www/ghost
4. curl -LOk https://ghost.org/zip/ghost-latest.zip
5. sudo rm -rf ghost/core
sudo rm -rf content/themes/
* optional
6. unzip -uo ghost-latest.zip -d ghost
* copy only new and updated files
7. sudo chown -R ghost:ghost ghost/*
* optional
8. cd /var/www/ghost
9. sudo npm install --production
10. sudo systemctl start ghost
optional (before npm install run):
- sudo rm -rf node_modules/
- sudo npm cache clean
unzip -uo
only copies files that are newer than the one that exist. This option is important to preserve all the data files.
once in a while installation will with weird errors such as “ERROR: AppField is already defined in the registry.”
in that case it is a good idea to replace /var/www/ghost/core
folder or even the entire installation except for content
folder and config.js
.
it also helps to troubleshoot problematic installs by starting ghost with npm start
for instance: npm start --production
to start ghost as a service
:
download init script
$ sudo curl https://raw.githubusercontent.com/TryGhost/Ghost-Config/master/init.d/ghost \ -o /etc/init.d/ghost
make sure /etc/init.d/ghost DAEMON
variable is the same as the output of which node
$ sudo useradd -r ghost -U $ sudo chown -R ghost:ghost /var/www/ghost $ sudo chmod 755 /etc/init.d/ghost
start the service on boot
$ sudo update-rc.d ghost defaults $ sudo update-rc.d ghost enable
Subscribe to The infinite monkey theorem
Get the latest posts delivered right to your inbox