Install Ghost CMS 2.9 on Ubuntu 18.04 / Ubuntu 16.04

(: December 30, 2018)

This guide will demonstrate how to Install Ghost CMS 2.9 on Ubuntu 18.04 / Ubuntu 16.04. Ghost is an open source publishing platform which is beautifully designed, easy to use, and free for everyone. It has full support for Markdown and provides an easy to use the web interface for administration purposes.

Setup Requirements

For this setup, the basic requirements are:

  • Ubuntu 18.04 / Ubuntu 16.04 Server
  • Nginx Web Server
  • FQDN – e.g
  • Node.js
  • MySQL / MariaDB Database Server
  • ghost user – Non-root user to manage it

Let’s start with the installation of Ghost requirements.{text-align:left} img{margin:0 auto 0 0}

Step 1: Install and Configure MySQL / MariaDB database server

Install a database server for Ghost CMS. This can either be MySQL or MariaDB database server. We have the guides for setting MySQL or MariaDB database server.

How to Install MySQL 8.0 on Ubuntu 18.04 / 16.04 

How to Install MariaDB 10.4 on Ubuntu 18.04 / Ubuntu 16.04

When done, Create the database for ghost blog you plan to add:

$ mysql -u root -p
CREATE USER [email protected] IDENTIFIED BY "StrongPassword";
GRANT ALL ON ghost.* TO [email protected];

Step 2: Installing Nginx  Web Server

Next is the installation of Nginx

sudo apt update
sudo apt -y install nginx

Step 3: Add User for Ghost administration

Add user called ghostadmin

sudo adduser ghostadmin
sudo usermod -aG sudo ghostadmin

Step 4: Install Node.js

Install Node.js 10 LTS since it is supported.

Installing Node.js 10 LTS on Ubuntu 18.04 / 16.04 / Debian 9

Confirm Node version

$ node -v

Step 5: Install Ghost-CLI

We now need to install the package ghost-cli which provides ghost command.

$ sudo npm i -g ghost-cli
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
/usr/bin/ghost -> /usr/lib/node_modules/ghost-cli/bin/ghost
[email protected]
added 377 packages from 182 contributors in 29.281s

Step 6: Create a new folder for Ghost Data

Please note that:

  • Installing Ghost in the /root folder won’t work and result in a broken setup!
  • Installing Ghost in your /home/{user} folder won’t work and result in a broken setup!
  • Please only use /var/www/{folder} because it has the right permissions.

So let’s create this directory:

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

Step 7: Install Ghost using Ghost-CLI

Create Ghost CMS directory.

su - ghostadmin
cd /var/www/ghost

Run the command below to install ghost:

$ ghost install
✔ Checking system Node.js version
✔ Checking logged in user
✔ Checking current folder permissions
✔ Checking operating system compatibility
✔ Checking for a MySQL installation
✔ Checking memory availability
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v2.9.1
✔ Finishing install process
? Enter your blog URL:
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghost
? Enter your MySQL password: [hidden] <ENTER PASSWORD>
? Enter your Ghost database name: ghost
✔ Configuring Ghost
✔ Setting up instance
sudo useradd --system --user-group ghost
sudo chown -R ghost:ghost /var/www/ghost/
✔ Setting up "ghost" system user
? Do you wish to set up "ghost" mysql user? Yes
MySQL user is not "root", skipping additional user setup
ℹ Setting up "ghost" mysql user [skipped]
? Do you wish to set up Nginx? Yes
✔ Creating nginx config file at /var/www/ghost/
sudo ln -sf /var/www/ghost/ /etc/nginx/sites-available/
sudo ln -sf /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
sudo nginx -s reload
✔ Setting up Nginx
? Do you wish to set up SSL? No
ℹ Setting up SSL [skipped]
? Do you wish to set up Systemd? Yes
✔ Creating systemd service file at /var/www/ghost/
sudo ln -sf /var/www/ghost/ /lib/systemd/system/ghost_blog-example-com.service
sudo systemctl daemon-reload
✔ Setting up Systemd
? Do you want to start Ghost? Yes
sudo systemctl is-active ghost_blog-example-com
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
sudo systemctl is-active ghost_blog-example-com
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
sudo systemctl start ghost_blog-example-com
✔ Starting Ghost
sudo systemctl is-enabled ghost_blog-example-com
sudo systemctl enable ghost_blog-example-com --quiet
✔ Enabling Ghost instance startup on server boot
Ghost uses direct mail by default. To set up an alternative email method read our docs at

Ghost was installed successfully! To complete setup of your publication, visit:

This will install and start your blog in production mode using MySQL as the default database. You can Agree to setup Let's Encrypt SSL . If your server has a valid domain name and Public IP Address.

Nginx configuration files will be placed under: /etc/nginx/sites-enabled/

Check service status:

$ systemctl status ghost_blog-example-com
● ghost_blog-example-com.service - Ghost systemd service for blog: blog-example-com
Loaded: loaded (/var/www/ghost/; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-12-30 17:06:48 EAT; 34min ago
Main PID: 19723 (ghost run)
Tasks: 18 (limit: 4915)
CGroup: /system.slice/ghost_blog-example-com.service
├─19723 ghost run
└─19734 /usr/bin/node current/index.js

Ghost Cheats:

Logs dir: /content/logs/
$ ghost start: Start ghost
$ ghost restart: Restart ghost
$ ghost run: Test if the ghost can start successfully
$ ghost uninstall: Re-install ghost
$ ghost update: Upgrade ghost
$ ghost update — force: Force upgrade if there are errors
$ ghost update –rollback: Revert to the earlier version if an upgrade fails
$ sudo npm i -g [email protected]: Upgrade Ghost-CLI
$ ghost ssl-renew: Renew ssl certificate
$ ls ./system/files/*.conf: System configuration files
$ ghost setup nginx: Manually Setup nginx
$ ghost setup nginx ssl: Setup nginx with SSL

Accessing Ghost Admin interface

Your setup is now ready, access Ghost web admin interface where you can upload themes, change settings and write content using markdown syntax.

To complete setup of your publication, visit:

Create your first Ghost administrator/publisher account.{text-align:left} img{margin:0 auto 0 0}