Hostwinds Tutorials

Search results for:


Table of Contents


Prerequisites:
Step 1: Install Nginx
Step 2: Install MySQL
Step 3: Install Node.js
Step 4: Install Ghost

How to Install Ghost CMS (Ubuntu 16.04 / 18.04 / 20.04)

Tags: Ubuntu 

Prerequisites:
Step 1: Install Nginx
Step 2: Install MySQL
Step 3: Install Node.js
Step 4: Install Ghost

Ghost CMS is a fast, secure, open-source platform built on Node.js that can be a good alternative to WordPress, Medium, or other blog platforms. While Ghost has built-in SEO support, member payments, and email newsletters, there is no eCommerce support yet, so it may not be right for you.

This guide will walk through the steps to install Ghost CMS on a server running Ubuntu 16.04, 18.04, or 20.04.

Prerequisites:

  • Create a sudo user.
  • Update the repository and upgrade packages.
  • Point your domain to your Hostwinds VPS using Hostwinds DNS Manager or using an A record at your DNS host.
  • Log in via SSH as the non-root sudo user. You will not be able to install Ghost as the root user.

Step 1: Install Nginx

Install Nginx by running:

sudo apt-get install Nginx

If ufw firewall is running on the server, allow Nginx through the firewall:

sudo ufw allow 'Nginx Full.'

Step 2: Install MySQL

Next, install the MySQL server:

sudo apt-get install mysql-server

At this point, it is recommended to use the secure installation script. Follow the prompts given:

sudo mysql_secure_installation

Ubuntu 18.04 and 20.04 only:

Lastly, ensure Ghost-CLI is compatible with MySQL. Set the root password with the following:

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '**password**';

quit

End Ubuntu 18.04 and 20.04 only.

Step 3: Install Node.js

Then you will need to install Node.js with the following:

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash
sudo apt-get install -y nodejs

Step 4: Install Ghost

We will first install Ghost-CLI, a useful tool for managing Ghost on your server:

sudo npm install ghost-cli@latest -g

It is required to install Ghost in a new directory so that we will create one called ghost:

sudo mkdir -p /var/www/ghost

Define the directory owner by replacing it with your username:

sudo chown **<user>**:**<user>** /var/www/ghost

Set the permissions:

sudo chmod 775 /var/www/ghost

Then change to the new directory:

cd /var/www/ghost

Now start the installation:

ghost install

Blog URL: Enter your domain pointed to the server, including the protocol (https://your-domain-name.com).

MySQL hostname: For this installation, we should use localhost, as MySQL was installed on this server. If your database is hosted on another server, enter the hostname.

MySQL username: For new installations, use root.

MySQL password: Enter the root password.

Ghost database name: Create a name for your database.

The remaining options are recommended, and SSL will be installed using Let's Encrypt.

Now you should be able to reach your Ghost blog at https://your-domain-name.com.  Start creating your blog at https://your-domain-name.com/ghost.

Written by Benjamin Bream  /  May 22, 2020