Websites & apps

Install Ghost CMS on an Ubuntu VPS with Ghost-CLI

Install the Ghost publishing platform on Ubuntu with Node.js, MySQL 8, Nginx and Ghost-CLI, including SSL, a systemd service, email settings, updates and backups.

IntermediateLinux VPS3 min read

Ghost is a fast Node.js publishing platform for blogs, newsletters and memberships. Its official tool, Ghost-CLI, automates most of the setup. This guide shows how to install Ghost CMS on an Ubuntu VPS the supported way.

Before you start

  • An Ubuntu LTS VPS with at least 1 GB RAM (2 GB recommended) and root access.
  • A domain whose A record points to the server (needed for SSL during install).
  • Check Ghost's documentation for the currently supported Node.js and Ubuntu versions before installing.

Create a non-root user

Ghost-CLI refuses to run as root and does not allow a user named ghost:

adduser ghostadmin && usermod -aG sudo ghostadmin && su - ghostadmin

Install Nginx and MySQL

sudo apt update && sudo apt install nginx mysql-server

Allow web traffic if UFW is on: sudo ufw allow 'Nginx Full'. Set a password for MySQL root (Ghost-CLI asks for MySQL credentials), or better, create a dedicated user:

sudo mysql -e "CREATE USER 'ghostdb'@'localhost' IDENTIFIED BY 'strong-password'; GRANT ALL ON ghost_prod.* TO 'ghostdb'@'localhost';"

Install Node.js and Ghost-CLI

Install a Node.js LTS version Ghost supports (for example from the NodeSource repository), then:

sudo npm install ghost-cli@latest -g

Install Ghost

sudo mkdir -p /var/www/ghost && sudo chown ghostadmin:ghostadmin /var/www/ghost && sudo chmod 775 /var/www/ghost
cd /var/www/ghost && ghost install

The installer asks:

  • Blog URL: https://example.com (include https).
  • MySQL hostname, username, password, database: localhost, the user above, ghost_prod.
  • 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 and create the owner account immediately.

Configure email

Ghost needs SMTP for staff invites, password resets and member sign-in links. Edit config.production.json:

"mail": {
  "transport": "SMTP",
  "options": {
    "host": "smtp.example.com",
    "port": 465,
    "secure": true,
    "auth": { "user": "no-reply@example.com", "pass": "mail-password" }
  }
}

Apply with ghost restart. Bulk newsletters are sent through Mailgun, configured in Ghost Admin.

Everyday commands

CommandDoes
ghost lsList installs and status
ghost restartRestart after config changes
ghost logShow logs
ghost doctorCheck the install for problems
ghost updateUpdate to the latest version
ghost backupExport content, settings and members (recent CLI versions)

Run them from /var/www/ghost as the non-root user.

Back up Ghost

  • Export content in Ghost Admin → Settings → Labs → Export (JSON) or with ghost backup.
  • Dump the database with mysqldump ghost_prod.
  • Copy /var/www/ghost/content (images, themes) and config.production.json.

Troubleshooting

  • ghost install fails on permissions: the folder must be owned by your user with mode 775, and its parents readable. ghost doctor explains what is wrong.
  • SSL step fails: DNS does not point to the server yet, or port 80 is blocked. Run ghost setup ssl later.
  • 502 Bad Gateway: the Ghost service is not running. Check ghost ls and ghost log; MySQL credentials or Node.js version mismatches are common.
  • Unsupported Node.js version: install the Node version listed in Ghost's requirements.

Ghost FAQ

Can I install Ghost on cPanel hosting?

Ghost officially supports only its Ubuntu stack; cPanel Node.js hosting is not a supported setup. Use a VPS.

Ghost or WordPress?

Ghost focuses on publishing and paid newsletters with a lean editor; WordPress offers far more themes and plugins for every kind of site.

Can I run Ghost in Docker?

Yes, there is an official image, but Ghost-CLI on Ubuntu is the setup Ghost documents and supports.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.