Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Install Ghost on Ubuntu 16.04

Install Ghost on Ubunt 16.04

In this blog post we will show you how to Install Ghost on an Ubuntu 16.04 VPS with the latest version of NGINX. Ghost is a new exciting blogging platform built on Node.js. The Ghost user interface is very simple and straightforward making it great for beginners as well as advanced users. This guide should work on other Linux VPS systems as well but was tested and written for Ubuntu 16.04 VPS.

First of all login to your Ubuntu 16.04 VPS via SSH as user root

ssh [email protected]_address

At the very beginning, it is best to start a screen session by executing the following command

screen -U -S ghost

Update the OS packages on your virtual server using the following commands:

apt-get update && apt-get -y upgrade

Make sure to always keep your server up to date.

1. Install NGINX

First, stop and remove Apache service, then install NGINX on your virtual server using the following commands:

service apache2 stop
apt-get purge apache2*
apt autoremove
apt-get install nginx-full

Edit the default NGINX configuration file:

nano /etc/nginx/sites-enabled/default

Delete the following line:

listen [::]:80 default_server;

Enable NGINX service to start on boot and start it:

systemctl enable nginx
systemctl start nginx.service

2. Install MariaDB 10.0

To install MariaDB, run the following command:

apt-get install -y mariadb-server

Next, we need to create a database for our Ghost installation.

mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE ghost;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON ghost.* TO 'ghostuser'@'localhost' IDENTIFIED BY 'your-password';
MariaDB [(none)]> \q

Do not forget to replace ‘your-password’ with a strong password.

3. Install Node.js

Add the NodeSource APT repository for Node 6:

curl -sL | sudo -E bash

and install it, by running the following command:

apt-get install -y nodejs

Install Ghost-CLI

npm i -g ghost-cli

Next, we need to create a new directory for our Ghost installation.

mkdir /var/www/ghost

Navigate to the newly created directory

cd /var/www/ghost

and install Ghost CMS using Ghost-CLI

ghost install

While installing the Ghost CMS, it will ask you to fill your website URL and MySQL database login credentials. Fill in the details and continue with your installation:

Enter your blog URL: http://your-domain-name
Enter your MySQL hostname: localhost
Enter your MySQL username: ghostuser
Enter your MySQL password: your-password
Enter your Ghost database name: ghost
Do you wish to set up Nginx? Yes
Do you wish to set up "ghost" mysql user? Yes
Do you wish to set up Systemd? Yes

At the end it should ask you ‘Do you want to start Ghost?’ , click Yes and if you configured everything correctly Ghost should be started and running on port 2368.

Your next step is to configure NGINX to act as a reverse proxy for your Ghost application. Open a config file:

nano /etc/nginx/sites-available/ghost

Add the following lines:

upstream ghost {

server {
    listen      80;

    access_log  /var/log/nginx/ghost.access.log;
    error_log   /var/log/nginx/ghost.error.log;

    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

location / {
        proxy_pass  http://ghost;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto https;


Do not forget to replace ‘’ with your actual domain name.

Enable the new NGINX configuration file:

ln -sf /etc/nginx/sites-available/ghost /etc/nginx/sites-enabled/

4. Test NGINX

Test the NGINX configuration and restart Nginx so the changes can take effect:

nginx -t
service nginx restart

Now you can visit your Ghost blog using your domain name and without having to specify the port number.

To set up Admin Account for your Ghost blog, navigate your web browser to:

That is it. The Ghost installation is now complete. Installing Ghost on Ubuntu 16.04 is an easy task if you followed our guide carefully.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

This post first appeared on Virtual Server, please read the originial post: here

Share the post

Install Ghost on Ubuntu 16.04


Subscribe to Virtual Server

Get updates delivered right to your inbox!

Thank you for your subscription