Overview
Ghost is a fast, open-source publishing platform built on Node.js. While there are dozens of content management systems available, Ghost is a popular choice for developers because it is highly customizable, optimized for search engines out of the box, and incredibly fast.
In this guide, we will set up a fresh Ghost blog using SQLite as our database, configure automatic streaming backups, and add a commenting system powered by GitHub issues.
Key points
- Set up a blog using Ghost CMS.
- Use SQLite as the database and configure automatic backups.
- Enable article comments using GitHub issues.
1. Set up Ghost CMS
First, choose your cloud host and virtual machine operating system. While Ubuntu Server is officially recommended by Ghost, Debian is an excellent, lightweight alternative that is highly stable and consumes fewer system resources.
For cloud hosting, a few cost-effective options include:
AWS Lightsail is often the most economical. A starter instance costs around $3.50 a month, which is perfect for new blogs, and you can easily scale the instance as your traffic grows.
Before starting, open ports 80 (HTTP) and 443 (HTTPS) in your hosting provider’s firewall settings.
If you choose Ubuntu, prepend
sudoto the commands below. If you choose Debian, run system administration tasks as root.
Install system updates
# Run as root or with sudo
apt update
apt upgrade -y
Install Node.js
# Run as root or with sudo
curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
apt install -y nodejs
Install Nginx
# Run as root or with sudo
apt install nginx
Note: Map your domain name (e.g.,
techflak.com) to the public IP address of your server in your DNS provider settings (like Route53 or GoDaddy). Wait for the DNS records to propagate before configuring your SSL certificate with Let’s Encrypt. You can verify it is working by opening your domain in a browser; you should see the default Nginx welcome page.
Install Ghost CLI and Ghost
# Run as root or with sudo
npm install ghost-cli@latest -g
# Create a home directory for your website
sudo mkdir -p /var/www/techflak.com
sudo chown <user>:<user> /var/www/techflak.com
sudo chmod 775 /var/www/techflak.com
# Change to the new directory
cd /var/www/techflak.com
# Run the installer with SQLite specified
ghost install --db=sqlite3
The installation wizard will ask a few setup questions. At the final step, when asked if you want to start Ghost immediately, select “no”. We need to install the SQLite module manually first.
# Run inside your site directory /var/www/techflak.com
npm install sqlite3 --save
# Start Ghost
ghost start
Your blogging platform is now live. You can log in, clean out the default starter articles, and start writing.
2. Configure SQLite backups
Backups are critical for protecting your data. In database engines like MySQL or PostgreSQL, you have built-in replication tools. Because SQLite is a single, local file, copying the file while Ghost is running can corrupt it.
Litestream solves this problem. It is a lightweight backup and replication utility designed specifically for SQLite. It continuously streams changes from your database file to any S3-compatible cloud bucket or local directory, allowing you to restore your database up to the moment of a crash.
Install Litestream
Run the following commands to install Litestream:
wget https://github.com/benbjohnson/litestream/releases/download/v0.3.3/litestream-v0.3.3-linux-amd64.deb
sudo dpkg -i litestream-v0.3.3-linux-amd64.deb
sudo systemctl enable litestream
Back up to local file system
Open /etc/litestream.yml and configure your backup path:
dbs:
- path: /var/www/techflak.com/content/data/ghost.db
replicas:
- path: /backup/db
Back up to AWS S3
Alternatively, you can replicate directly to an S3 bucket:
dbs:
- path: /var/www/techflak.com/content/data/ghost.db
replicas:
- url: s3://mybkt.techflak.com/db
region: us-east-1
access-key-id: AKIAxxxxxxxxxxxxxxxx
secret-access-key: xxxxxxxxxxxxxxxxxxxxxx
After updating the configuration file, start the service to begin streaming your database changes:
sudo systemctl start litestream
3. Enable comments with GitHub issues
Ghost does not include native article comments out of the box. A few common integration options are:
- Utterances (Open-source, free, and ad-free)
- Isso (Self-hosted comment engine)
- Disqus (Ad-supported and tracks user data)
Utterances is an elegant, lightweight solution for technical blogs because it uses GitHub issues for comment storage and does not require running a separate server.
To configure Utterances:
- Create a public GitHub repository named after your domain (e.g.,
username/techflak.com). - Install the Utterances App and grant it access to that repository.
- Open your Ghost admin panel, navigate to Settings > Code injection, and paste the following script into your blog footer:
<script
src="https://utteranc.es/client.js"
repo="<github-user>/techflak.com"
issue-term="pathname"
theme="github-light"
crossorigin="anonymous"
async
></script>
Comments will now render at the end of each blog post.
Customizing comment placement
If the comments do not line up perfectly with your blog theme, you can write custom JavaScript to target a specific HTML container. Most Ghost themes use a container element with the class .post-full-comments or .comments.
Paste this script into your Ghost footer settings:
function setupComments() {
var container = document.getElementsByClassName("post-full-comments")[0];
if (container) {
container.innerHTML = "";
var script = document.createElement("script");
script.setAttribute("src", "https://utteranc.es/client.js");
script.setAttribute("repo", "<github-user>/techflak.com");
script.setAttribute("issue-term", "pathname");
script.setAttribute("theme", "github-light");
script.setAttribute("crossorigin", "anonymous");
script.setAttribute("async", true);
container.prepend(script);
}
}
setTimeout(setupComments, 0);
Conclusion
Ghost is an exceptionally fast, SEO-friendly blogging platform that takes the friction out of publishing. Running it on SQLite makes deployment and server maintenance simple, while tools like Litestream keep your data secure without the complexity of a dedicated database server.