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 - ghostadminInstall Nginx and MySQL
sudo apt update && sudo apt install nginx mysql-serverAllow 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 -gInstall Ghost
sudo mkdir -p /var/www/ghost && sudo chown ghostadmin:ghostadmin /var/www/ghost && sudo chmod 775 /var/www/ghostcd /var/www/ghost && ghost installThe 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
| Command | Does |
|---|---|
ghost ls | List installs and status |
ghost restart | Restart after config changes |
ghost log | Show logs |
ghost doctor | Check the install for problems |
ghost update | Update to the latest version |
ghost backup | Export 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) andconfig.production.json.
Troubleshooting
- ghost install fails on permissions: the folder must be owned by your user with mode 775, and its parents readable.
ghost doctorexplains what is wrong. - SSL step fails: DNS does not point to the server yet, or port 80 is blocked. Run
ghost setup ssllater. - 502 Bad Gateway: the Ghost service is not running. Check
ghost lsandghost 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.
