How To

Install Ghost on Ubuntu 18.04: Node.js, MySQL, and Nginx SSL

Ghost is an open-source publishing platform built on Node.js. It is designed for bloggers, journalists, and independent publishers who want a fast, customizable platform they can self-host. Ghost handles content management, membership subscriptions, email newsletters, and SEO out of the box.

This guide covers how to install Ghost on Ubuntu 18.04 in production mode using MySQL as the database, Nginx as a reverse proxy, and a free Let’s Encrypt SSL certificate.

<strong>Prerequisites:</strong>&nbsp;You need sudo access (not root), a domain pointing to your server IP, Nginx installed, ports 80 and 443 open in your firewall, and at least 1 GB of RAM.

Install Ghost on Ubuntu: Node.js, Yarn, MySQL, and Ghost-CLI Prerequisites

Install Node.js v8 LTS from the NodeSource repository. Ghost 1.x pins its Node.js compatibility tightly — a version mismatch causes the Ghost-CLI installer to fail. Node.js v8 “Carbon” LTS is the required version for this Ghost release:

bashcurl -sL https://deb.nodesource.com/setup_8.x | sudo bash -sudo apt install nodejs

Install Yarn. Ghost-CLI uses Yarn as its package manager:

bashcurl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.listsudo apt updatesudo apt-get -o Dpkg::Options::="--force-overwrite" install yarn

The --force-overwrite flag resolves conflicts between Yarn’s file structure and Ubuntu system package paths.

Install MySQL and change the root authentication method. Ghost’s database connector sends a username and password when connecting. MySQL 5.7’s default auth_socket plugin ignores that password and validates by matching the Linux username instead, which breaks Ghost’s database setup:

bashsudo apt install mysql-serversudo mysql_secure_installationsudo mysql
sqlALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your-strong-password';FLUSH PRIVILEGES;

Install Ghost-CLI globally:

bashsudo yarn global add ghost-cli

Ghost-CLI is more than a one-time installer. After setup, you use ghost startghost stopghost restartghost log, and ghost ls to manage your installation.

Create the installation directory. Ghost must NOT be installed as root. Ghost-CLI checks for this and refuses to proceed:

bashsudo mkdir -p /var/www/ghostsudo chown $USER:$USER /var/www/ghostsudo chmod 775 /var/www/ghost

Run the Ghost-CLI Installer and What Each Step Does

bashcd /var/www/ghostghost install

Ghost-CLI checks the system first and prints a warning about Ubuntu 16 compatibility. Type y to continue on Ubuntu 18.04. This warning is expected and does not indicate a real problem.

The installer then guides you through a series of prompts:

  1. Blog URL: enter https://your-domain.com
  2. MySQL hostname, username, password: use root and the password you set
  3. Database name: use the default ghost_prod

After the database setup, the installer creates a ghost system user automatically and asks if you want to create a ghost MySQL user. Answer Yes.

The installer then asks three more questions in sequence:

  • Set up Nginx? Yes — Ghost-CLI creates the Nginx config and symlinks it into /etc/nginx/sites-enabled/
  • Set up SSL? Yes — Ghost-CLI uses its bundled acme.sh tool (not the system certbot) to issue a Let’s Encrypt certificate for your domain
  • Set up Systemd? Yes — creates the service ghost_example-com (Ghost uses your domain name as the service identifier, replacing dots with hyphens)

The installer runs database migrations, starts Ghost, and enables the service on boot. It prints the admin URL at the end.

Complete the Ghost Admin Setup and Manage Your Installation

Open https://your-domain.com/ghost/ in a browser. Click Create your account, fill in the blog title, your name, email, and a strong password. The first account created has full administrator access — set this up before sharing your site URL.

On the next screen, invite collaborators by email or click I’ll do this later to go straight to the Ghost dashboard. From there you can write posts, manage users, install themes, and configure settings.

Useful Ghost-CLI commands for day-to-day management:

  • ghost ls: list all Ghost installations and their status
  • ghost start / ghost stop / ghost restart: control the running instance
  • ghost log: tail the Ghost error log
  • ghost update: upgrade to the latest Ghost version

Ghost is now installed and running in production mode on Ubuntu 18.04. Visit the Ghost Help Center to explore advanced configuration like custom themes, member subscriptions, and email newsletters. Leave a comment below if you run into any issues.

Cyber Defence

Recent Posts

Install Asterisk on Ubuntu 18.04: Source Build and Secure Config

Asterisk is the most widely deployed open-source PBX (Private Branch Exchange) platform in the world. It…

33 minutes ago

Install Mattermost on Ubuntu 18.04: Nginx SSL Reverse Proxy Setup

Mattermost is an open-source, self-hosted team messaging platform and a direct alternative to Slack. It is…

43 minutes ago

Install Ruby on Ubuntu 18.04: apt, Rbenv, and RVM Methods

Ruby is a dynamic, open-source programming language known for its clean, readable syntax. It powers the…

48 minutes ago

Install PyCharm on Ubuntu 18.04: Community Edition via Snap

PyCharm is a full-featured Python IDE developed by JetBrains. It includes built-in debugging, embedded Git control,…

53 minutes ago

Install PHP on Ubuntu 26.04: Apache, Nginx, and Multiple Versions

PHP 8.5 is included in Ubuntu 26.04's default repositories and is the recommended version for…

2 days ago

Upgrade to Ubuntu 26.04 from 25.10 and 24.04 LTS: Complete Guide

Ubuntu 26.04 LTS "Resolute Raccoon" arrived on April 23, 2026 with Linux kernel 7.0, GNOME 50,…

2 days ago