You could earn up to $300 by adding new articles!Get Started Now
Ghost is a modern, open source publishing platform built on Node.js with an Ember.js admin client, a JSON API, and a theme API powered by Handlebars.js. Ghost team recently released a new version of Ghost with a lot of new features and improvements: new markdown editor with the toolbar to help you with styling your post, UI/UX improvements, drag and drop multiple images, improved installation and update process with new tool called Ghost-CLI, new default theme Casper v2.0.0 and much more. I leave it to you to explore more after you install it.
In this tutorial we are going to install, setup and configure a Ghost v1.0.0 on Ubuntu 16.04 LTS using MySQL, Let's Encrypt, Node.js, NPM, Ghost-CLI and NGINX.
NOTE: Ubuntu 16.04 LTS is the only officially supported Linux distribution. It is not possible to install Ghost v1.0.0 on other Linux distributions. In future, it will probably be possible to install it when they add support for other distributions in Ghost-CLI tool.
Ghost team recommends the following server stack and setup for production installation of Ghost v1.0.0 blog:
Check Ubuntu version:
lsb_release -ds # Ubuntu 16.04.3 LTS
Create a new non-root user account with
sudo access and switch to it:
johndoewith your username
adduser johndoe --gecos "John Doe" usermod -aG sudo johndoe su - johndoe
Set up the timezone:
sudo dpkg-reconfigure tzdata
Ensure that your system is up to date:
sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential
First, we will need to install MySQL database as Ghost recommends it as database for production environment.
Download and install MySQL:
sudo apt install -y mysql-server
NOTE: You will be prompted to enter password for the MySQL "root" user. Enter strong password!
Check MySQL version:
mysql --version # mysql Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using EditLine wrapper
Harden MySQL Server by running
Next, we need to install NGINX software. It will be used as a reverse proxy for our Ghost application. Ghost-CLI can configure NGINX as a reverse proxy for you automatically.
Download and install NGINX:
sudo apt install -y nginx
Check NGINX version:
sudo nginx -v # nginx version: nginx/1.10.3 (Ubuntu)
Ghost v1.0.0 currently supports Node.js versions 6.9+ and 4.5+ only. The recommended version of Node.js to use with Ghost v1.0.0 is currently Node.js v6 Boron LTS.
Ghost is built on Node.js. Ghost is following Node's LTS plan, only supporting LTS versions of Node.js. So, we will need to install latest LTS version of Node.js.
Download and install Node.js and NPM:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt install -y nodejs
Check Node.js and NPM version:
node -v && npm -v # v6.11.3 # 3.10.10
Ghost-CLI is a CLI tool for installing and updating Ghost. It makes installing and updating Ghost easy. It can set up database for you, configure NGINX as a reverse proxy, set up TLS security by using Let's Encrypt, automatic SSL renewal and set up ghost as a systemd service. It will take care of basic security for you, by creating dedicated system user called
ghost for running Ghost blog.
Install Ghost-CLI via npm:
sudo npm install -g ghost-cli@latest
Check Ghost-CLI version:
ghost version # Ghost-CLI version: 1.1.1
ghost doctor command to check that your environment is compatible with Ghost-CLI:
ghost doctor ✔ Checking system Node.js version ✔ Checking current folder permissions ✔ Checking operating system ✔ Checking MySQL is installed ✔ All install checks passed
Get help about
To get more specific help about
ghost subcommands you can run
ghost help <command>. For example to get help about
ghost config command, run:
ghost help config
NOTE: Make sure DNS records for your domain are set up. This tutorial uses example domain
blog.example.tldwith your domain/hostname.
Now we are ready to install Ghost CMS. The only way to install Ghost v1.0.0 is by using Ghost-CLI tool.
Create document root directory:
sudo mkdir -p /var/www/ghost
Change the ownership of the
/var/www/ghost directory to the non-root user with
sudo privileges that you have created in the beginning of this tutorial:
sudo chown <johndoe>:<johndoe> /var/www/ghost
Navigate to document root directory:
NOTE: Make sure
/var/www/ghostdirectory is empty before installing Ghost and your user must own this directory.
Install Ghost in a production mode:
Answer the questions it prompts with. For more information about questions it prompts visit Ghost docs:
? Enter your blog URL: https://blog.example.tld ? Enter your MySQL hostname: localhost ? Enter your MySQL username: root ? Enter your MySQL password: [Enter password you created when you installed MySQL] ? Enter your Ghost database name: [Whatever you want] ? 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) [Your email for Let's Encrypt] ? Do you wish to set up "ghost" mysql user? yes ? Do you wish to set up Systemd? yes ? Do you want to start Ghost? yes
NOTE: After installation, NGINX configuration files will be in
/var/www/ghost/system/filesdirectory. Ghost-CLI will ask you
Do you wish to set up Nginx?and if your answer is
yes, then it will configure NGINX as a reverse proxy for you automatically. Your NGINX config files will be in
After installation is complete you can run
ghost ls to view running Ghost process:
Also to check if Ghost is installed you can run
ghost version again from
ghost version # Ghost-CLI version: 1.1.1 # Ghost Version (at /var/www/ghost): 1.8.4
In future when newer version of Ghost is released just run
ghost update command in from
/var/www/ghost directory to update ghost. Also, before updating make a backup of you blog from admin interface.
To complete the setup process and create Ghost admin account, navigate to the Ghost configuration page by appending
/ghost to the end of your blog’s URL. This example uses
We have successfully installed and configured our new Ghost v1.0.0 blog for production. Ghost-CLI tool makes our life much easier by eliminating manual steps we had to do with older
v0.11.x Ghost. You can also do everything manually without the help of Ghost-CLI tool but you will lose the ability to easily update your blog with
ghost update command. Doing everything manually is laborious and not recommended. The only downside is the fact that other Linux distributions are not supported at this moment.