Installation of Ghost
There are a lot of operating systems available for the Raspberry Pi but, for this, we recommend using Raspbian. The rest will be a breeze.
1. Install Node.js
2. Acquire the Ghost setup
Download the package
To install Ghost, it’ll need to be download from the official website. Do that by entering the following in the terminal.
Unzip the package
Now that the package has been downloaded, it will have to be unzipped. You can simply do it by entering the command.
unzip ghost-latest.zip -d ghost
The package contents will fill a new directory by the name ghost.
3. Focus on the new folder
To set the Ghost folder ghost as current directory use the command.
4. Install Ghost from the setup
After focusing on the ghost directory, we need to install it using NPM by entering the command below.
sudo npm install --production
5. Install a database management system
For your database management system you can choose your favourite one and use it with Ghost. We ourselves have done it a few times with MySQL and MariaDB. We’ve gone for SQLite for this tutorial – the Ghost configuration file by default uses SQLite. You can install SQLite3 using the command below.
sudo apt-get install sqlite3
6. Edit the configuration file
If you use MariaDB, MySQL or a different management system make the appropriate changes to the settings in config.js file of the Ghost setup.
Edit the config.js file to change the default host: and set the port: to 80 as seen below. That is, of course, unless you’re fine with using the default settings.
7. Set up Forever
Once we’re done editing config.js, we need to install Forever so we could continue running the Node.js web-server after the end of the SSH session.
Enter this command.
sudo npm install forever -g
Set Node.js to run with Forever
This will let Node.js continue running despite being in production mode. Enter them one after another.
sudo NODE_ENV=production forever start index.js
sudo forever index.js --production
And that’s it!
You’ll have successfully created a Raspberry Pi hosted Ghost blog on its Node.js web server.
You’ll have to visit [the-IP-address-of-your-Raspberry-Pi]/ghost/ to access the process of creating your user account the first time. The process takes a while because the password is hashed using Bcrypt. Once done, that URL acts as your Ghost admin panel.
The blog can be accessed as a non-admin viewer using your Raspberry Pi’s IP address.
Cool, isn’t it?! Do leave us comments if you’ve decided to give it a try or have tried alternate methods for installation. Feedback is always appreciated. Do stay tuned for more on Ghost in the future…