Update: Tonight (18 June 2018) I used the below on a fresh install of Raspbian Lite to install Ghost 1.24… so, yes, it still works!
I’ve made the switch from WordPress to Ghost for my personal site and thus thought I’d go through the steps for you to join the fun. One would think it would be uber easy to do install, and it is, however, official documentation will tell you that you need to install it on Ubuntu 16.04 LTS. Infact, when you install it there is a warning that you’re not using Ubuntu. Don’t worry about it… you can install it on Raspbian (Stretch Lite, even better!). Also of note, you can run both WordPress & Ghost on the same server (I’m doing it now with this site, my photo site (Ghost), and two client (friends) sites running WordPress… four in all).
For my install I’m using a Raspberry Pi 3, Raspbian (Stretch), and Ghost 1.19 (released the day I installed this). And I also give much of the credit for this guide to Wesley over at GhostPi.pro, he’s led the charge for we Raspberry Pi users for quite some time.
A little security goes a long way
For this install I’m assuming you’re doing so from a fresh install of Raspbian. Before we go on our Ghost adventure we should start with some security apps. I recommend we install UncomplicatedFireWall (UFW) and fail2ban. Let’s open up terminal and start this fun…
sudo install ufw fail2ban
After that’s done we’ll set up UFW to allow HTTP, HTTPS, and SSH. If you want you can also do FTP… but I use SFTP which piggybacks on SSH so I don’t allow FTP outright.
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
For FTP you can add
sudo uft allow ftp.
Let’s double check ourselves with
sudo ufw show added
You should get something that looks like this-
ufw allow 22/tcp ufw allow 80/tcp ufw allow 443/tcp
We’ll add a rule for Nginx in a bit after it’s installed.
If all looks get we can start up UFW-
sudo ufw enable
Then let’s ensure all is right in the world and see what UFW is allowing into our web server-
sudo ufw status verbose
Here’s what mine looks like with the Niginx rule added-
The last part of the security area is to start fail2ban with a single command-
sudo service fail2ban start
And that’s that. Let’s move on to the actual install of Ghost.
Though I noted above I’m assuming you’re working with a fresh install of Raspbian it would be ill of me to not encourage you to run update at least once in a tutorial. So here we go, with a follow on add of Nginx, MariaDB, and the addition of a Nginx UFW rule-
sudo apt update && sudo apt-get upgrade -y
sudo apt install nginx mariadb-server -y
sudo ufw allow 'Nginx Full'
With MariaDB there is no setting up of the root password out of the box. No problem though, we’ll set one up via-
You will press Enter then you’ll be asked if you want to set up your password. The answer should be yes. I would also suggest you answer yes to the rest of the questions for safe measure. Here’s what it’ll look like-
You need not worry about creating a database like we do with WordPress, the Ghost install will do it for you. However, because of the way Ghost installs on Raspbian we need to do a quick fix to MariaDB. Open up our mysql-
sudo mysql -u root -p
You’ll be asked for your password that you just created. At our MariaDB prompt we type –
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
Some people have issues with what’s called a hash bucket memory problem when all of this is implemented. So, to avoid this we need to make another edit. Open:
sudo nano /etc/nginx/nginx.conf
And locate the server_names_hash_bucket_size and uncomment it (remove the #) and ensure it’s at
We’ll test Nginx to ensure nothing weird has happened, and then restart it:
sudo nginx -t
sudo systemctl restart nginx
Next we’ll work to get Node.js and the Ghost Command Line Interface (Ghost-CLI) tool installed. Type-
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash
sudo apt-get install -y nodejs
sudo npm i -g [email protected]
Most will say this’ll take a while to load (the CLI) but in my experience, it’s pretty fast. Next it’s time to install Ghost which takes about 10 minutes, give or take…
You’ll get a warning that you’re not installing this on Ubuntu… yes, we know. Press ‘y’ to continue.
After it’s done loading we get into the actual install screen-
By default you could press enter on all of the fields auto-fill them, however, I wouldn’t. Use the domain name you plan to use, or I guess you could use your local IP, but that’s outside of this tutorial. You’ll also need to input the MariaDB/mysql password you created earlier.
Be sure you’ve set up your router to port forward both HTTP/80 and HTTPS/443 to your RPi otherwise your SSL setup within the Ghost setup my not work correctly.
As far as seeing your new site from the web, it should be good to go without any further tinkering so long as you allowed Ghost to set up Nginx for you (I would recommend it). If you have any questions please feel free to ask below.