Introduction
Ghost is a modern Node.js based CMS. Its core benefit is to create publications and send newsletters to readers. In this tutorial, I will guide you on how to install Ghost on Ubuntu 20.04 LTS. I am using Ubuntu 20.04 LTS edition. These instructions and commands are for Ubuntu distribution only. Installing on Debian or other apt repository-based distribution may result in a system break. I will use Ghost version 4.2 to install.
Prerequisites
First, I want you to make sure that the latest LTS version of Node, Nginx, and MySQL are installed and running on your system using the following command:
$ node --version
$ npm --version
$ nginx --version
$ mysql --version
If they are not installed then use the following commands to install them:
$ sudo apt update
$ sudo apt install node
$ sudo apt install npm
$ sudo apt install nginx
$ sudo apt install mysql
To install MySQL, you will need a username and password during the process. MySQL, during the installation process, will ask you to enter a database username and password itself.
Now follow the steps to install the Ghost CMS without any fuss.
Installation Method
Step 1. Install Ghost CLI
Run the following npm command to install Ghost CLI. Ghost CLI is the core component to manage a Ghost instance, and it can only be installed globally. It doesn’t work if you try to install it into a specific directory. No need to worry as I will show, you how to create a new directory in the second step to install a Ghost instance.
$ sudo npm install ghost-cli@latest -g
Ghost has successfully installed and has added a few hundred packages to run.
Step 2. Create A Directory
Create a new directory using mkdir command, name it, and change the directory path. It will be ghostCMS in my case.
$ mkdir ghostCMS
$ cd ghostCMS/
Step 3. Install Ghost Instance
Now run the install command as follows:
$ ghost install
Ghost CLI will ask you some questions like setting up your publication’s name, URL, and related details.
Answer them, and you will be all good. I am installing it on localhost, so the URL will be slightly different.
Step 4. Run Ghost Setup
Once done you will be able to set up your new website admin in the browser as follows:
Step 5. Preview Dashboard
In this final step, you would now create an account and access the dashboard as shown below:
Remove Ghost
To remove Ghost CMS you would need to apply the following command.
$ sudo npm remove ghost
All the related packages will be uninstalled then.
Conclusion:
We installed a fresh instance of Ghost CMS on our system in a few simple steps. Installing Ghost CMS is straightforward. We used Ghost CMS version 4.2 to install on Ubuntu 20.04 LTS.