Install Ghost CMS on your VPS (Tutorial)

Ghost CMS: How to install on your Ubuntu 16.04 VPS

Today we’ll talk you through how to install Ghost on your VPS using Ubuntu 16.04

The Ghost CMS is simple, elegant, and responsive platform for blogging. Unlike WordPress, the Ghost CMS is meant exclusively for blogging– so it’s not set up to handle something more extensive, like an e-commerce website.

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
  • Systemd
  • NodeJS
  • At least 1GB memory
  • A non-root user for running ghost commands

Source: Ghost

Prerequisites for your Ghost CMS install

  • 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. For example, an A record named test would point to test.DOMAIN.TLD.

8 Year Anniversary Sale—> 16GB RAM from $9.99/mo!

It’s been 8 years since we launched our all-SSD VPS cloud. To celebrate, we’re offering amazing deals on all of our most popular plans– like a 16GB RAM SSD VPS loaded with resources for as little as $9.99/month!

Get limited-time deals!⚡


  • This tutorial requires the use of domain names. Whenever you see either the SUBDOMAIN, DOMAIN, or TLD variables, replace them with the details of your domain name. In, example is the SUBDOMAIN, ssdnodes is the DOMAIN, and .com is the TLD.
  • This tutorial requires the use of passwords. Whenever you see the PASSWORD variable, then replace it with your own.

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 | 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

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)

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 [email protected]

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
$ [email protected]: 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 protected]
? 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.


Click Create your account.


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.


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!

You can now start blogging with this awesome platform. Consult the official documentation for theming instructions and other configurations.