Ghost is an open-source publishing platform for blogs, magazines and paid newsletters. It’s fast (Node.js), has a clean editor, built-in SEO, memberships and email newsletters. Self-hosting it on a VPS costs a fraction of managed Ghost hosting once you’re comfortable running a server.
Ghost’s recommended production stack: Ubuntu LTS, Nginx, MySQL 8, Node.js LTS (a version Ghost supports), and the official Ghost-CLI, which automates most of the setup.
Requirements
- Ubuntu 22.04 or 24.04 with a non-root sudo user (Ghost-CLI refuses to run as root).
- At least 1 GB RAM (2 GB recommended; add swap on small servers).
- A domain pointing to the server.
1. Prepare the server
sudo apt update && sudo apt upgrade -y
sudo apt install -y nginx mysql-server
sudo ufw allow 'Nginx Full'
Ghost requires MySQL 8 in production (not MariaDB). Set a password for MySQL’s root user, which Ghost-CLI uses once to create the Ghost database and user:
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'a-strong-root-password';
FLUSH PRIVILEGES;
EXIT;
(Some MySQL versions prefer caching_sha2_password; check Ghost’s docs for the current recommendation. Alternatively create a dedicated MySQL user and database yourself and give Ghost-CLI those credentials.)
2. Install Node.js
Install the Node.js LTS version supported by your Ghost release via NodeSource — see installing Node.js on Ubuntu:
node -v
3. Install Ghost-CLI
sudo npm install -g ghost-cli@latest
4. Create the site directory
sudo mkdir -p /var/www/ghost
sudo chown $USER:$USER /var/www/ghost
sudo chmod 775 /var/www/ghost
cd /var/www/ghost
5. Install Ghost
ghost install
The installer checks the system, downloads Ghost, and asks:
- Blog URL —
https://example.com(use https). - MySQL hostname/username/password —
localhost,rootand the password you set. - Ghost database name — accept the default.
- Set up a ghost MySQL user? — Yes (Ghost then uses its own limited user).
- Set up Nginx? — Yes.
- Set up SSL? — Yes; enter your email for Let’s Encrypt.
- Set up systemd? — Yes.
- Start Ghost? — Yes.
Open https://example.com/ghost to create your admin account.
6. Email: two kinds
Ghost sends two types of email:
- Transactional (login links, password resets, member sign-in) — configure SMTP in
config.production.json:
"mail": {
"transport": "SMTP",
"from": "Example <[email protected]>",
"options": {
"host": "smtp.example.com",
"port": 587,
"secure": false,
"auth": { "user": "[email protected]", "pass": "smtp-password" }
}
}
- Bulk newsletters — Ghost’s built-in newsletter sending uses Mailgun; enter your Mailgun domain and API key in Settings → Email newsletter.
Restart after config changes:
cd /var/www/ghost && ghost restart
Set up SPF, DKIM and DMARC for your sending domain — see SPF, DKIM and DMARC.
7. Everyday Ghost-CLI commands
ghost status # running instances
ghost restart
ghost log # recent logs
ghost doctor # check for common problems
ghost update # update Ghost
ghost backup # back up content (newer CLI versions)
Run them from /var/www/ghost as your normal user.
8. Updating
cd /var/www/ghost
ghost backup # if available in your CLI version
ghost update
Ghost-CLI keeps the previous version so ghost update --rollback can revert. Major Ghost versions may require a newer Node.js — check the release notes first.
9. Backups
Back up:
- Content:
/var/www/ghost/content(images, themes, settings files). - Database:
mysqldump --single-transaction ghost_prod > ghost.sql(use the database name fromconfig.production.json). - Config:
config.production.json.
Exports from the admin (Settings → Labs → Export) provide a JSON copy of posts and settings. See mysqldump backups.
Docker alternative
Official Docker images exist, and Ghost publishes a Docker-based self-hosting setup for newer versions. The Ghost-CLI method remains well documented and easy for a single site on its own server.
Performance tips
- Put a CDN or Cloudflare in front for global audiences.
- Ghost is already fast; most sites need no extra caching.
- 2 GB RAM is comfortable for a busy blog with MySQL on the same server.
Ghost vs WordPress
Ghost is focused: writing, publishing, memberships and newsletters, with excellent defaults. WordPress is a general-purpose CMS with a vast plugin ecosystem. See WordPress vs Ghost.
An Ubuntu VPS is exactly what Ghost-CLI expects — install takes about ten minutes.