Ghost Self-Hosted Installation and Setup
Ghost self-hosted deploys via official CLI on Ubuntu. Minimum requirements: 1 CPU core, 1 GB RAM (2 GB recommended), Ubuntu 20.04/22.04, Node.js 18.x, MySQL 8.
Server Preparation
# System update
sudo apt update && sudo apt upgrade -y
# Node.js 18 via NodeSource
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
# MySQL 8
sudo apt install -y mysql-server
sudo mysql_secure_installation
# Nginx
sudo apt install -y nginx
# Ghost CLI
sudo npm install -g ghost-cli@latest
MySQL setup:
CREATE USER 'ghost'@'localhost' IDENTIFIED BY 'strongpassword';
CREATE DATABASE ghost_prod CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON ghost_prod.* TO 'ghost'@'localhost';
FLUSH PRIVILEGES;
Ghost Installation
sudo mkdir -p /var/www/ghost
sudo chown $(whoami):$(whoami) /var/www/ghost
cd /var/www/ghost
ghost install \
--url https://myblog.com \
--db mysql \
--dbhost localhost \
--dbuser ghost \
--dbpass strongpassword \
--dbname ghost_prod \
--process systemd \
--mail SMTP \
--mailhost smtp.mailgun.org \
--mailport 587 \
--mailssl true \
--mailuser [email protected] \
--mailpass mailgunpassword \
--mail-from [email protected]
Ghost CLI auto-configures Nginx virtual host and requests SSL via Certbot.
Useful Management Commands
ghost status # service status
ghost stop / start # stop/start
ghost restart # restart
ghost update # update to latest version
ghost log # view logs
ghost config # edit config.production.json
ghost backup # create backup (zip with content and files)
Custom Configuration
// /var/www/ghost/config.production.json
{
"url": "https://myblog.com",
"database": {
"client": "mysql2",
"connection": { "host": "localhost", "user": "ghost", "password": "...", "database": "ghost_prod" }
},
"mail": {
"transport": "SMTP",
"options": { "host": "smtp.mailgun.org", "port": 587, "auth": { "user": "...", "pass": "..." } }
},
"storage": {
"active": "s3",
"s3": {
"accessKeyId": "...",
"secretAccessKey": "...",
"bucket": "myblog-media",
"region": "eu-west-1",
"assetHost": "https://cdn.myblog.com"
}
},
"imageOptimization": { "resize": true, "srcsets": true },
"privacy": { "useUpdateCheck": true, "useGravatar": false }
}
Installation and basic setup on prepared VPS — 2–4 hours.







