Install Ghost (CMS) Blog Publishing Platform on Debian and Ubuntu

Ghost is an open-source content management system built on Node.js, known for its simplicity, speed, and elegant design. This modern publishing platform offers a clean interface for bloggers and content creators who prioritize writing and performance. In this tutorial, we will walk through the complete installation process of Ghost on both Debian and Ubuntu systems.

Prerequisites

Before beginning the installation, ensure you have the following requirements ?

  • A server or virtual machine running Debian or Ubuntu

  • Root or sudo access to the system

  • At least 1GB RAM and 10GB disk space

  • A registered domain name (optional but recommended)

Step 1: Update System Packages

First, update your system packages to ensure you have the latest security patches and software versions ?

sudo apt update && sudo apt upgrade -y

Step 2: Install Node.js and NPM

Ghost requires Node.js version 16 or higher. Install Node.js using the NodeSource repository ?

sudo apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs

Verify the installation by checking the versions ?

node --version
npm --version
v18.17.0
9.6.7

Step 3: Install Ghost-CLI

Ghost-CLI is the official command-line tool for installing and managing Ghost installations. Install it globally ?

sudo npm install -g ghost-cli@latest

Step 4: Create Ghost Directory and User

Create a dedicated directory and user for Ghost to enhance security ?

sudo adduser --system --group ghost --home /var/www/ghost
sudo mkdir -p /var/www/ghost
sudo chown ghost:ghost /var/www/ghost
sudo chmod 775 /var/www/ghost

Step 5: Install MySQL Database

Ghost requires a MySQL database for production installations ?

sudo apt install -y mysql-server
sudo mysql_secure_installation

Create a database and user for Ghost ?

sudo mysql -u root -p
CREATE DATABASE ghost_production;
CREATE USER 'ghost'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON ghost_production.* TO 'ghost'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 6: Install Nginx

Install Nginx as a reverse proxy for Ghost ?

sudo apt install -y nginx
sudo systemctl enable nginx
sudo systemctl start nginx

Step 7: Install Ghost

Navigate to the Ghost directory and run the installation ?

cd /var/www/ghost
sudo -u ghost ghost install

The installation wizard will prompt you for configuration details ?

Prompt Example Value Description
Blog URL https://yourdomain.com Your blog's public URL
MySQL hostname localhost Database server location
MySQL username ghost Database user
MySQL password your_strong_password Database password
Database name ghost_production Ghost database name
Set up Nginx? Yes Configure reverse proxy
Set up SSL? Yes Enable HTTPS with Let's Encrypt
Set up systemd? Yes Enable auto-start on boot

Step 8: Access Ghost Admin

Once installation completes, access your Ghost blog at https://yourdomain.com and the admin panel at https://yourdomain.com/ghost. Create your admin account to complete the setup.

Step 9: Essential Ghost Management Commands

Here are key commands for managing your Ghost installation ?

# Start Ghost
sudo -u ghost ghost start

# Stop Ghost
sudo -u ghost ghost stop

# Restart Ghost
sudo -u ghost ghost restart

# Check Ghost status
sudo -u ghost ghost status

# Update Ghost
sudo -u ghost ghost update

# View Ghost logs
sudo -u ghost ghost log

Step 10: Backup and Maintenance

Regular backups are essential for any production website. Create a backup script ?

#!/bin/bash
DATE=$(date +%Y%m%d_%H%M%S)
BACKUP_DIR="/backup/ghost"

# Create backup directory
mkdir -p $BACKUP_DIR

# Backup Ghost content and database
cd /var/www/ghost
sudo -u ghost ghost export --file $BACKUP_DIR/ghost_content_$DATE.json
mysqldump -u ghost -p ghost_production > $BACKUP_DIR/ghost_db_$DATE.sql

echo "Backup completed: $DATE"

Troubleshooting Common Issues

Issue Solution
Port 2368 already in use Check for existing Ghost instances: sudo -u ghost ghost ls
Permission denied errors Ensure ghost user owns the directory: sudo chown -R ghost:ghost /var/www/ghost
SSL certificate issues Renew certificate: sudo certbot renew
Database connection failed Verify MySQL credentials and database exists

Conclusion

Ghost provides a modern, fast, and user-friendly platform for content publishing. Following this installation guide, you now have a production-ready Ghost blog with SSL encryption, database storage, and proper system integration. Regular maintenance, backups, and updates will ensure your Ghost installation remains secure and performant.

Updated on: 2026-03-17T09:01:39+05:30

675 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements