You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

This guide will demonstrate how to Install Ghost CMS on Ubuntu 18.04 (Bionic Beaver) Linux distribution. 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.

For CentOS / RHEL: Install and Configure Ghost CMS on CentOS / RHEL 7/8

Setup Requirements

For this setup, the basic requirements are:

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

Let’s start installation of Ghost on Ubuntu 18.04 LTS.

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";
CREATE DATABASE ghost;
GRANT ALL ON ghost.* TO [email protected];
FLUSH PRIVILEGES;
QUIT

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
v10.15.0

Step 5: Install Ghost-CLI on Ubuntu 18.04

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 on Ubuntu 18.04 (Bionic Beaver)

Create Ghost CMS directory.

su - ghostadmin
cd /var/www/ghost
mkdir blog.example.com
cd blog.example.com

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: http://blog.example.com
? 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/blog.example.com/content
✔ 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/blog.example.com/system/files/blog.example.com.conf
sudo ln -sf /var/www/ghost/blog.example.com/system/files/blog.example.com.conf /etc/nginx/sites-available/blog.example.com.conf
sudo ln -sf /etc/nginx/sites-available/blog.example.com.conf /etc/nginx/sites-enabled/blog.example.com.conf
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/blog.example.com/system/files/ghost_blog-example-com.service
sudo ln -sf /var/www/ghost/blog.example.com/system/files/ghost_blog-example-com.service /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 https://ghost.org/mail

Ghost was installed successfully! To complete setup of your publication, visit:
http://blog.example.com/ghost/

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/blog.example.com/system/files/ghost_blog-example-com.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-12-30 17:06:48 EAT; 34min ago
Docs: https://docs.ghost.org
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 on Ubuntu 18.04

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.

You have successfully installed Ghost CMS on Ubuntu 18.04. Also check other guides on web hosting and documentation.

Best Commercial Web Hosting Control Panels – Cpanel Alternatives

Best Free and Open Source Web Hosting Control Panels

NextCloud vs ownCloud vs Seafile vs Syncthing

Ceph vs GlusterFS vs MooseFS vs HDFS vs DRBD

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

LEAVE A REPLY

Please enter your comment!
Please enter your name here