Article

Table of Contents
Theme:
Was this article helpful?

1  out of  2 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles!

Install Ghost CMS on Ubuntu 20.04

Author: Thomas Rakwach

Last Updated: Thu, Jul 29, 2021
Blogging CMS Ubuntu

Introduction

Ghost is a lightweight, open-source Content Management System (CMS) and blogging platform built with Node.js. It is customizable and has many pre-built themes available. In this article, you'll learn how to install Ghost CMS on Ubuntu 20.04.

Prerequisites

1. Create the Ghost Database

  1. SSH to the server as your non-root user with sudo access.
  2. Login to mysql.

    $ sudo mysql -u root -p
    
  3. Create a database named ghost.

    CREATE DATABASE ghost;
    
  4. Create a database user named ghost.

    CREATE USER 'ghost'@'localhost' IDENTIFIED WITH mysql_native_password BY 'StrongPassword';
    
  5. Grant all privileges of the ghost database to the user ghost.

    GRANT ALL ON ghost.* TO 'ghost'@'localhost';
    
  6. Flush privileges for the changes to take effect.

    FLUSH PRIVILEGES;
    
  7. Exit MySQL.

    exit

2. Install Nginx

  1. Install Nginx.

    $ sudo apt-get install nginx -y
    
  2. Enable Nginx server to start on boot.

    $ sudo systemctl enable nginx
    
  3. Allow firewall for both HTTP and HTTPS connections.

    $ sudo ufw allow 'Nginx Full'
    

3. Install Node.js

  1. Add the NodeSource APT repository for Node 14.

    $ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash
    
  2. Install Node.js.

    $ sudo apt-get install nodejs -y
    

4. Install Ghost

  1. Install Ghost-CLI.

    $ sudo npm install ghost-cli@latest -g
    
  2. Create a directory /var/www/ghost/.

    $ sudo mkdir -p /var/www/ghost/
    
  3. Set ownership of the directory to the current user account.

    $ sudo chown -R $USER:$USER /var/www/ghost/
    $ sudo chmod 775 /var/www/ghost
    
  4. Go to /var/www/ghost/ directory.

    $ cd /var/www/ghost/
    
  5. Install Ghost.

    $ ghost install
    
  6. Answer the prompts as shown.

    ? Enter your blog URL: https://ghost.example.com
    ? Enter your MySQL hostname: localhost
    ? Enter your MySQL username: ghost
    ? Enter your MySQL password: [hidden]
    ? Enter your Ghost database name: ghost
    ? Configuring Ghost
    ? Setting up instance
    ? Do you wish to set up Nginx? Yes
    ? Do you wish to set up Systemd? Yes
    ? Do you want to start Ghost? (Y/n) Y
    
  7. Navigate to your Ghost admin portal. For example:

    https://ghost.example.com/ghost/
    

More Information

Want to contribute?

You could earn up to $600 by adding new articles