ghost-cli

Installation
SKILL.md

Ghost CLI

Overview

Ghost-CLI is the official command-line tool for installing and managing Ghost CMS. It handles production setup including MySQL, NGINX, SSL certificates (Let's Encrypt), and systemd process management. It also supports local development installations with SQLite.

When to Use

  • Installing Ghost on a server or locally for development
  • Configuring Ghost (URL, database, mail, ports)
  • Starting, stopping, or restarting Ghost instances
  • Updating Ghost to new versions
  • Setting up NGINX, SSL, and systemd
  • Creating backups
  • Diagnosing installation issues
  • Managing multiple Ghost instances on one server

Installation

sudo npm install -g ghost-cli@latest

Use @latest to install or update in one command.

Global Flags

Flag Description
--help, -h Display usage information
--verbose, -V Enable debug logging
--version, -v Print CLI and Ghost versions
--dir [path] Execute in alternate directory
--no-prompt Skip interactive prompts
--no-color Disable colored output

Commands

ghost install

Full production installation including MySQL, NGINX, SSL, and systemd:

ghost install                    # Latest version
ghost install [version]          # Specific version (e.g., 5.82.0)
ghost install local              # Local dev mode (SQLite, no NGINX)
ghost install --local            # Same as above

Options:

Flag Description
--development, -D Development environment
--dir [path] Custom install directory
--archive path/to/file.tgz Install from local archive
--no-stack Skip environment validation
--no-setup Skip setup stage
--no-start Skip automatic startup
--no-enable Don't auto-restart on reboot
--no-prompt Non-interactive mode

Directory structure created:

/var/www/ghost/
├── .config.production.json    # Instance configuration
├── .ghost-cli                 # CLI metadata
├── content/                   # Themes, images, data
├── current/                   # Symlink to active version
├── system/                    # NGINX, systemd, SSL files
└── versions/                  # Ghost versions (for rollback)

ghost setup

Configure server components after installation:

ghost setup                    # Run all setup stages
ghost setup mysql              # Create database user
ghost setup nginx              # Generate NGINX config
ghost setup ssl                # Let's Encrypt SSL
ghost setup nginx ssl          # NGINX + SSL combined
ghost setup linux-user         # Create ghost system user
ghost setup systemd            # Create systemd service
ghost setup migrate            # Initialize database

Options:

Flag Description
--no-setup-mysql Skip database configuration
--no-setup-nginx Skip web server setup
--no-setup-ssl Skip SSL certificate
--no-setup-systemd Skip process manager
--no-setup-linux-user Skip user creation
--no-setup-migrate Skip database migration
--pname my-process Custom process name

ghost config

Manage site configuration:

ghost config                          # Create/view config
ghost config [key]                    # Get value
ghost config [key] [value]            # Set value
ghost config url https://mysite.com   # Set site URL

Application options:

ghost config --url https://mysite.com
ghost config --admin-url https://admin.mysite.com
ghost config --port 2368
ghost config --ip 127.0.0.1
ghost config --log '["file","stdout"]'

Database options:

ghost config --db mysql
ghost config --dbhost localhost
ghost config --dbuser ghost
ghost config --dbpass secret
ghost config --dbname ghost_prod

# SQLite (development)
ghost config --db sqlite3
ghost config --dbpath content/data/ghost_dev.db

Mail options:

ghost config --mail SMTP
ghost config --mailservice Mailgun
ghost config --mailuser postmaster@mg.example.com
ghost config --mailpass password
ghost config --mailhost smtp.eu.mailgun.org
ghost config --mailport 465

ghost start

ghost start                    # Start Ghost
ghost start -D                 # Start in development mode
ghost start --enable           # Enable auto-restart on reboot
ghost start --no-check-mem     # Skip memory check

ghost stop

ghost stop                     # Stop current instance
ghost stop [name]              # Stop named instance
ghost stop --all               # Stop all instances
ghost stop --disable           # Prevent auto-restart

ghost restart

ghost restart                  # Restart current instance
ghost restart --dir /path/     # Restart specific instance

ghost update

ghost update                   # Update to latest
ghost update [version]         # Update to specific version
ghost update --rollback        # Revert failed update
ghost update --force           # Force re-download
ghost update --no-restart      # Skip restart after update
ghost update --no-auto-rollback # Disable automatic rollback
ghost update --zip path.zip    # Update from local archive
ghost update --no-check-mem    # Skip memory check

ghost backup

Create a full backup including:

  • Content in JSON format
  • Member CSV export
  • All installed themes
  • Images, files, media (video/audio)
  • routes.yaml and redirects.yaml
ghost backup

ghost doctor

Diagnostic checks for system compatibility:

ghost doctor                   # Full diagnostics
ghost doctor startup           # Configuration validation
ghost doctor setup             # Installation verification
ghost doctor --no-check-mem    # Skip memory checks

ghost ls

List all Ghost instances with status:

ghost ls

ghost log

View Ghost logs:

ghost log                      # Last 20 access log lines
ghost log -n 100               # Show 100 lines
ghost log -e                   # Error logs only
ghost log -f                   # Follow logs (tail -f)
ghost log -fe                  # Follow error logs
ghost log [name]               # Named instance logs

Log files are stored in content/logs/:

  • Access: https__mysite_com__production.log
  • Errors: https__mysite_com__production.error.log

ghost uninstall

Destructive — permanently removes Ghost:

ghost uninstall                # With confirmation prompt
ghost uninstall --no-prompt    # Skip confirmation
ghost uninstall --force        # Force removal

Removes: Ghost process, systemd config, NGINX config, content, and files.

SSL Configuration

Ghost integrates with Let's Encrypt via acme.sh for free SSL:

ghost setup ssl                # Interactive SSL setup
  • Certificates auto-renew every 60 days
  • Ghost supports only one canonical domain (for SEO)
  • Redirect additional domains via NGINX

Adding HTTPS Redirect for Additional Domain

ghost config url https://my-second-domain.com
ghost setup nginx ssl
ghost config url https://my-canonical-domain.com
# Edit NGINX config to add: return 301 https://my-canonical-domain.com$request_uri;
sudo nginx -t && sudo nginx -s reload

Manual acme.sh

/etc/letsencrypt/acme.sh --home "/etc/letsencrypt"

File Permissions

Ghost-CLI enforces these defaults:

  • Non-root: directories 775, files 664
  • Root: directories 755, files 644

Reset if needed:

sudo find /var/www/ghost/* -type d -exec chmod 775 {} \;
sudo find /var/www/ghost/* -type f -exec chmod 664 {} \;

Production Requirements

  • Node.js: v22+ (Ghost 6.0)
  • Database: MySQL 8 (production), SQLite3 (development only)
  • Web Server: NGINX (configured automatically)
  • Process Manager: systemd (configured automatically)
  • OS: Ubuntu 20.04+ or similar Linux (recommended)
  • Memory: Minimum 1GB RAM

Common Troubleshooting

Issue Solution
Port already in use ghost config --port 2369 or stop conflicting process
Permission errors Run ghost doctor and fix ownership
NGINX config issues sudo nginx -t to validate, check /etc/nginx/
SSL renewal failure Run ghost setup ssl again
Memory errors Use --no-check-mem flag or upgrade server
Database connection Verify MySQL credentials with ghost config
Related skills
Installs
2
First Seen
Apr 11, 2026