Running Ghost with Node v5 (Ubuntu 14.04LTS)

Updated: 13 Apr 16

Ghost is a blogging platform that makes it so easy to set up a really beautiful blog.

As I was setting this up, I went through trouble as Node v5 is not supported by Ghost.

I am running node v5.6.0 and npm v3.7.5 which are currently the latest.

To set up Ghost with Node v5, do the following:

Use sudo when needed

  1. Move to your web directory and create a folder for the blog:

    cd /var/www
    mkdir blog
    cd blog
  2. Get the latest Ghost and unzip it:

  3. Install for production mode without checking for node version:

    GHOST_NODE_VERSION_CHECK=false npm install --production
  4. Install sqlite3 v3.1.0 locally:

    Note: In Ghost >=0.7.8, step 4 is not needed anymore.

    npm install sqlite3@3.1.0
  5. Run your Ghost in production mode without checking for node version:

    GHOST_NODE_VERSION_CHECK=false npm start --production
  6. It should run fine, as it just did with me. Copy the configuration and edit it as needed:

    cp config.example.js config.js
    vim config.js
  7. To run it in a service deamon:

    GHOST_NODE_VERSION_CHECK=false NODE_ENV=production forever start index.js

Setting up nginx server block for Ghost

After setting up Ghost over a port, one could use nginx to proxy pass the port to a subdomain.

  1. Create a new server block in conf.d or sites-available (depending on what you use):

    cd /etc/nginx/conf.d
    touch blog.conf
  2. Edit your server block as follows:

    server {
       listen 80;
       access_log /var/log/nginx/blog.log;
       location / {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header HOST $http_host;
          proxy_set_header X-NginX-Proxy true;
          proxy_redirect off;

    Edit the subdomain and the port as needed.

  3. Reload nginx configuration:

    sudo nginx -s reload

Your blog should be now available at your subdomain.

Setting up service upstart

To set the service to start when your server boots up, do the following:

  1. Create a new init.d script:

    sudo curl \
    -o /etc/init.d/ghost
  2. Allow it to run as a script:

    sudo chmod +x /etc/init.d/ghost
  3. Edit the contents to match your directories:

    sudo vim /etc/init.d/ghost
    export GHOST_NODE_VERSION_CHECK=false NODE_ENV=production
  4. Stop forever if it is still running, and start the blog using the init.d script:

    sudo service ghost start
  5. Set it to run at system start:

    sudo update-rc.d ghost defaults
    sudo update-rc.d ghost enable

Your blog setup is now complete.

I have also written a Ghost init.d script for Centos 7.0. You can find it here.

Zaid Daba'een

A traveller and an entrepreneur. Making wireless charging smart. UK Exceptional Talent. Interned at @NASA.