Ghost is a modern,  open-source blogging platform written in NodeJS.  The latest releases of Ghost CMS 1.10+ come with a brand new Markdown editor, a refreshed UI, a new default theme design, and a lot more features that make for a nicer blogging experiencing.

 

Installing Ghost CMS is pretty straightforward and Ghost officially recommends the following stack and server setup:

  • Ubuntu 16.04
  • MySQL
  • NGINX
  • Systemd
  • NodeJS
  • At least 1GB memory
  • A non-root user for running ghost commands

 

Prerequisites:

  • A VPS running Ubuntu 16.04.
  • A non-root, sudo-enabled user. If you only have a root user, see our SSH tutorial for details on creating new users.
  • A registered domain name.
  • A DNS A record that points to your server’s IP address based on the FQDN you want to use.

 

Getting your server ready to install Ghost CMS

 

Ghost is built on NodeJS, and the latest release of Ghost 1.0 supports NodeJS versions 8.9+ and 6.9+ only. You can pick either of the NodeJS versions, but for this tutorial, we will use NodeJS version 8. To install it, add the NodeSource APT repository to your server first.

$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash

 

Now install NodeJS with the following apt-get command:

$ sudo apt-get install nodejs

 

Check the version of Node and NPM:

$ node -v && npm -v
v8.11.3
5.6.0

 

Install MariaDB and create a database

 

Ghost supports either MySQL/MariaDB or SQLite databases. However, for this tutorial, we will be using the MariaDB database. You can also opt for MySQL instead of MariaDB.

 

Install the latest stable release of MariaDB server on your system by using following apt-get command:

$ sudo apt-get install mariadb-server

 

Next, run mysql_secure_installation to configure a few settings of MariaDB like updating the root password, removing the test database, and more, to make it secure.

$ sudo mysql_secure_installation

 

Once the MariaDB server is installed and configured in your server, create a user and a database especially for Ghost. To do that, log in to the MariaDB server using mysql -u root -p command and complete the steps as described below.

$ mysql -u root -p
Enter password:

MariaDB [mysql]> CREATE DATABASE blog;
Query OK, 1 row affected (0.00 sec)

MariaDB [mysql]> CREATE USER 'ghostuser'@'localhost' IDENTIFIED BY 'PASSWORD';
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> GRANT ALL ON blog.* TO 'ghostuser'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> exit

 

Install Nginx

 

Ghost runs on port 2368, which is different from standard web server port 80 typically employed by either Apache or Nginx. To direct traffic to Ghost, you need to configure a proxy server that will act as a front end. Ghost officially recommends Nginx as a proxy server, although you can use Apache to do the same job. To install Nginx, issue the following command from the terminal:

$ sudo apt-get install nginx
$ sudo systemctl enable nginx

 

Install Ghost-CLI

 

Ghost-CLI is a command-line interface (CLI) tool to install and update Ghost in the terminal. Ghost-CLI makes it easy to install Ghost by selecting the database, configuring NGINX as a reverse proxy, setting up a Let’s Encrypt SSL certificate, and creating a systemd service with a single command.

 

The objective of the Ghost CLI project is to make setting up and maintaining a Ghost site as straightforward as possible for people who do not want to use Ghost(Pro). Source: Ghost-CLI

 

Since Ghost-CLI is an NPM module, it can be installed using either npm or yarn. We will use npm to install it.

$ sudo npm install -g ghost-cli@latest

 

Check the version of Ghost-CLI using following command:

$ ghost -v
Ghost-CLI version: 1.8.1

 

Install Ghost

 

To install Ghost, navigate to the /var/www/html and create a folder for it.

$ cd /var/www/html
$ sudo mkdir -p /var/www/html/blog

 

Note: Installing Ghost in the /root or /home/USER folder won’t work and result in a broken setup! Please only use /var/www/html because it has the right permissions.

 

Once you’re done with creating the installation folder for Ghost, change the ownership of the folder to a non-root, sudo-enabled user. The installation of Ghost will not proceed if the ownership of the newly created folder remains with root user. For this tutorial, we have created a non-root, sudo-enabled user by the name bloguser. Check this tutorial to create a non-root, sudo-enabled user.

 

Note: Don’t give this new user the name ghost! Ghost-CLI will create a ghost user for managing the blog during installation.

$ sudo chown bloguser:bloguser /var/www/html/blog

 

Next, assign correct permissions to the installation folder.

$ sudo chmod 775 /var/www/html/blog

 

Change to the shell of the non-root user and subsequently navigate to the Ghost installation folder /var/www/html/blog to install it.

$ su - bloguser
$ bloguser@localhost: cd /var/www/html/blog/

 

Now install Ghost using Ghost-CLI. Answer the prompts as followed:

? Enter your blog URL: https://DOMAIN.TLD
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghostuser
? Enter your MySQL password: PASSWORD
? Enter your Ghost database name: blog
? Do you wish to set up "ghost" mysql user? no
? Do you wish to set up Nginx? yes
? Do you wish to set up SSL? yes
? Enter your email (used for Let's Encrypt notifications) EMAIL@DOMAIN.TLD
? Do you wish to set up Systemd? yes
? Do you want to start Ghost? yes

 

Your Ghost installation should be finished at this point! You can now access it via https://DOMAIN.TLD or https://SUBDOMAIN.DOMAIN.TLD, depending on your particular configuration.

 

Complete the Ghost CMS setup

 

To complete the setup process, point your browser to the Ghost CMS configuration page at https://DOMAIN.TLD/ghost.

 

STEP 1

 

Click Create your account.

 

STEP 2

 

Fill up all the details, like the blog’s title, your name, email address, and password. The email address and password will be used by Ghost to authenticate the admin user at later stages. Once done click Invite your team to add more members to your team.

 

STEP 3

 

Or, click the I’ll do this later, take me to my blog! link to visit the admin section and change your site’s theme or configure additional settings.

 

The setup of Ghost CMS is complete!

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)