TemperStack
Intermediate12 min readUpdated Mar 18, 2026

How to self-host Ghost on a VPS

Quick Answer

Self-hosting Ghost on a VPS involves installing Node.js, MySQL/MariaDB, configuring Ghost CLI, and setting up a reverse proxy with SSL. The process typically takes 30-60 minutes and provides full control over your blog.

Prerequisites

  1. VPS with Ubuntu 20.04+ or similar Linux distribution
  2. Domain name pointed to your VPS IP address
  3. Basic command line knowledge
  4. SSH access to your VPS
1

Connect to VPS and Update System

Connect to your VPS via SSH and update the system packages:

ssh root@your-vps-ip
apt update && apt upgrade -y

Install essential packages:

apt install -y curl wget unzip software-properties-common
Tip
Consider creating a non-root user for better security before proceeding with Ghost installation.
2

Install Node.js and npm

Install Node.js 18.x LTS which is required for Ghost:

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
apt install -y nodejs

Verify the installation:

node --version
npm --version

Both commands should return version numbers.
Tip
Ghost requires Node.js 16.x or higher. Always use LTS versions for production environments.
3

Install and Configure MySQL/MariaDB

Install MariaDB server:

apt install -y mariadb-server

Secure the installation:

mysql_secure_installation

Create a database for Ghost:

mysql -u root -p
CREATE DATABASE ghost_production;
CREATE USER 'ghost'@'localhost' IDENTIFIED BY 'your-secure-password';
GRANT ALL PRIVILEGES ON ghost_production.* TO 'ghost'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Tip
Use a strong password for the ghost database user and write it down as you'll need it during Ghost configuration.
4

Install Ghost CLI and Create Installation Directory

Install Ghost CLI globally:

npm install ghost-cli@latest -g

Create a directory for Ghost and set proper permissions:

mkdir -p /var/www/ghost
chown $USER:$USER /var/www/ghost
chmod 775 /var/www/ghost
cd /var/www/ghost
Tip
Never install Ghost in your home directory for production. Use /var/www/ghost or similar system directory.
5

Install and Configure Ghost

Run the Ghost installation command:

ghost install

Follow the prompts to configure:
  • Enter your blog URL (e.g., https://yourdomain.com)
  • Enter your MySQL hostname: localhost
  • Enter your MySQL username: ghost
  • Enter your MySQL password: your-secure-password
  • Enter your database name: ghost_production

The installer will automatically set up Nginx and SSL certificates.
Tip
If installation fails, run 'ghost doctor' to diagnose issues before retrying.
6

Configure Ghost and Create Admin User

Once installation completes, Ghost will start automatically. Visit your domain in a browser and you'll see the Ghost setup screen.

Navigate to https://yourdomain.com/ghost to access the admin panel and create your first user account:
  • Enter your site title
  • Enter your full name
  • Enter your email address
  • Create a secure password

Click Create account & start publishing to complete setup.
Tip
The first user created automatically becomes the owner with full administrative privileges.
7

Configure Firewall and Enable Ghost Service

Configure UFW firewall to allow necessary ports:

ufw allow 'Nginx Full'
ufw allow ssh
ufw --force enable

Ensure Ghost starts automatically on system boot:

ghost start
systemctl enable ghost_yourdomain-com

Check Ghost status:

ghost status
Tip
Regularly update Ghost using 'ghost update' command to keep your installation secure and up-to-date.

Troubleshooting

Ghost installation fails with permission errors
Ensure you're not running as root user and the Ghost directory has correct ownership: chown -R $USER:$USER /var/www/ghost
SSL certificate generation fails
Verify your domain is properly pointing to your VPS IP address and port 80/443 are not blocked: nslookup yourdomain.com
Ghost won't start after installation
Check Ghost logs for errors: ghost log and ensure MySQL service is running: systemctl status mariadb
Cannot access Ghost admin panel
Verify Nginx is running and configured correctly: systemctl status nginx and check if Ghost is listening on correct port: ghost status

Related Guides

More Ghost Tutorials

Other Tool Tutorials

Ready to get started with Ghost?

Put this tutorial into practice. Visit Ghost and follow the steps above.

Visit Ghost