Full article

How To Install Ghost on Ubuntu 16.04 LTS

In this tutorial you will learn how to setup and self-host ghost on your server.

What is Ghost?

Ghost is a free and open source blogging platform written in JavaScript and distributed under the MIT License, designed to simplify the process of online publishing for individual bloggers


  • Ubuntu 16.04
  • Nginx(min 1.9.5 for SSL)
  • Node.js
  • MySQL 5.5/5.6/5.7
  • VPS with at least 1GB Ram
  • A domain name

Step 1 - Login to Your Server

Login to your server as root via ssh, and create a new user.

ssh [email protected]
adduser username

Add the new user to the supergroup user.

usermod -aG sudo username

Now log in with the new user.

su - username

Step 2 - Update the system

Once you are logged in via the new user, run the following commands to update the system.

sudo apt-get update
sudo apt-get upgrade

Step 3 - Install NGINX

Ghost uses nginx, run the following command to install nginx.

sudo apt-get install nginx

If ufw firewall is enabled on your server, make sure it's not blocking HTTP/HTTPS connection.

sudo ufw allow 'Nginx Full'

Step 4 - Install MySQL

sudo apt-get install mysql-server

During the installation of MySQL, you will be asked to choose a password for the root user. Set a password you want and press enter.

Step - 5 Install Node.js

Once the MySQL server is installed, install node.js via the following commands.

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash
sudo apt-get install -y nodejs

Step 6 - Install Ghost - CLI

Install Ghost-CLI, the command line tool that you can use to manage and setup ghost on your server.

sudo npm install [email protected] -g

Step 7 - Create the directory where ghost will be installed, and setup the permissions.

In this step you need to create the directory where ghost will be installed, and to make sure that the user has the right permission to install ghost.

Create The Directory

The command below will create the directory where you want ghost installed. You can name the directory anything you want.

sudo mkdir -p /var/www/ghost


Give the directory another name, In cases when you are self-hosting more than one ghost instances on your server.

 sudo mkdir -p /var/www/domain.com

Set up permission for the user that will own this directory.  By running the following command below, you are giving permissions to that user for managing ghost. To do that, simply replace user:user with the username of the user you created in the step 1.

sudo chown user:user /var/www/ghost

Make sure the user has the correct permission.

sudo chmod 775 /var/www/ghost

Step 8 - Final Step, Install Ghost

Navigate to the ghost directory.

cd /var/www/ghost

Then run the following command for installing Ghost.

ghost install

During the installation process, ghost-cli will need the following information:

1. Blog url

Set the correct blog url, url should start with either: http:// or https://

2. MySQL Hostname

Leave the hostname as is "localhost" if the mysql server is installed on the same server.

3. MySQL Username and Password

Username is root
Password is the same password you created during the installation of MySQL server.

4. Ghost Database Name

Set the database name, and press enter.

Once you are done with the steps above, answer with "Yes" to the following questions :

Set up a ghost MySQL user? Yes
Set up NGINX? Yes

Set up SSL? Yes
If you answer yes to SSL you will need to provide your email address, that email address will be used to manage/renew your ssl certificate. Set the email address, and press enter to continue.

Set up systemd? Yes
Start GHOST? Yes

Now that ghost is installed, here are some useful commands that you will need to know to manage ghost easily.

Useful commands to Manage Ghost

To manage ghost, you need to login to the user that owns the ghost directory, not via root user.

Update Ghost

ghost update

Start Ghost

ghost start

Stop Ghost

ghost stop

Restart Ghost

ghost restart

To get the full list of available commands, type ghost help


In this tutorial, you learned step by step how to install manually, and self-host ghost on your server. Personally i like to have total control over my server, that's why i prefer the manual way. However, this it's not the only way to install ghost, some hosting companies(Including Ghost Itself with Ghost Pro) offer ghost as a one click installer, that allows you to install ghost via one click.


Endrit Qerreti

Linux Enthusiast, Coder, Security Researcher, Linux Sys Admin, Night owl.