Why Ghost Is One of the Best Blogging Tools for Raspberry Pi
Ghost’s main claim to fame is its simplicity, and developers claim that the Ghost blogging experience is focused on providing the best possible writing and publishing experience. Unlike WordPress, where functionality is enhanced by paid and free plug-ins, Ghost offers most of what you need baked into the base package.
If you’re planning on monetizing your blog, these tools can be invaluable, and include the ability to publish both via the web and email newsletter. Delving further into Ghost’s features, you’ll find the ability to set up a membership system, and paid subscriptions—you can easily turn your blog into a business.
Best of all, while Ghost does offer scalable paid hosting for between $9 and $2,500 per month, the software is open source—meaning that you are free to download, modify, redistribute, or install it on your own hardware. We’ll show you how to install it on your Raspberry Pi.
How to Install Ghost on a Raspberry Pi
Before you begin, you will need to follow our tutorial on how to prepare your Raspberry Pi as a server. Once that’s done, visit your registrar’s Advanced DNS settings page. Delete all records and create a new A record. Set the host to “@”, the value to your public IP address, and the TTL as low as possible.
If you are going to access Ghost through a subdomain, e.g., ghost.improbable.guru, you will instead set the A record to “ghost”. Log into your Raspberry Pi using Secure Shell (SSH), then update any upgrade and installed packages:
Now enable these two Apache mods and restart Apache:
Change directory, and use nano to create a new Apache conf file:
…and enter:
Save and exit nano with Ctrl + O then Ctrl + X.
Enable the conf with:
…and restart Apache again.
Add a Database
Ghost needs a database in order to work, so enter MariaDB:
Create a new user called ghost, a new database called ghost, then allow the ghost user to use the ghost database:
Install Node.js
Move to your home directory, and enable the NodeSource repository, then install Node.js and Node package manager (npm):
Typing:
…should reveal your Node version. In our case, the output is v16.17.0. Yours may be different.
Install Ghost
Use npm to install the Ghost installation tool:
Change directory, then create a new directory called ghost:
Move into the new directory, then use the Ghost installation tool to install Ghost:
System checks will fail with the warning that “Linux version is not Ubuntu 16, 18, or 20”, but you can safely ignore this and type y to continue. A second message will warn you, “Local MySQL install was not found or is stopped”. Keep your nerve and tap y to skip the MySQL check and continue. Ghost will now download and install. On our test Raspberry Pi, this process took around 10 minutes.
Set Up Your Blog Account
Once completed, you will be asked for your blog URL, as well as details of your MySQL database. As you installed MariaDB rather than vanilla MySQL, these details will be the ones you set for MariaDB. Your hostname will be localhost, your MySQL username will be ghost, and your MySQL database name will be ghost, and the password will be the fiendishly difficult database password you set earlier. When asked “Do you wish to set up Systemd”, type y, then y again when queried whether you want to start Ghost.
Open a browser and visit your-domain-name.tld/ghost/. You will be prompted to create the first account, so fill in the fields with the site name, your name, your email address, and a password. Ghost will insist on a password of at least ten characters; be sure to create a password that is secure and memorable.
Click on Create account and start publishing to proceed to your site. As soon as you do this, you will receive an email from noreply@your-domain.tld, telling you that your new account has been created.
Before you go any further, you need to secure your Ghost installation with SSL from Let’s Encrypt.
Enter your email address when requested, and select which name would you like to activate HTTPS for.
Certbot will fetch and install SSL keys and certificates from Let’s Encrypt. Now restart Apache:
When you reload the page in your browser, the connection to your Ghost blog will be secure, and you will need to log in again.
Building a Website With Ghost on Your Raspberry Pi
As the developers state, Ghost is very intuitive to use, and there will already be an auto-generated home page with your site title, a dummy post, and a readable “About” page declaring your Ghost site to be an independent publication by you, and the date of initiation.
The admin page is accessed through your-domain.tld/ghost/ and the website admin tools are on the right side of the screen. To create a new post, simply click +. The editor itself is a minimalist WYSIWYG block editor similar to that of WordPress, and is easy to use with no distractions.
From the dashboard, you can add members, create mailing lists, view engagement, and customize your Ghost site.
You Can Easily Install the Ghost Blogging Platform on Your Raspberry Pi!
Ghost is one of many easy-to-install self-hosting projects for the Raspberry Pi. It costs you nothing to install and nothing to run. Why not create a new blog based around your adventures in the exciting world of Raspberry Pi self-hosting projects?