Hello everyone today I am going to show you that how you can install Ghost Machine on Hostinger VPS.

First let me tell you what ghost machine is? What it do?

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

Ghost is coded in Node.js, a server-side JavaScript execution engine, based on Google's V8. The interface is intended to be simple, and an analytics dashboard is planned, as of January 2014.Editing is facilitated using a split screen display.

So now we know about ghost and what we are going to do.

We can’t install ghost on Hostinger VPS by using ghost official tutorial or any tutorial that you know. The reason behind it is that Hostinger have some missing packages which doesn’t allow ghost to be installed. Ghost requires new packages.

Here we are going to use Ubuntu 16.04 LTS Operating System and I have made a list of all missing packages which we have to install manually and after that we can easily install ghost on Hostinger VPS.

Now connect to your VPS using SSH.

Setting Up All Packages


1. Run command

apt-get remove apache2 apache2-doc apache2-bin apache2-data apache2-utils

This command will remove the apache2 service from Hostinger VPS. This service is pre-installed here

2. Run command

apt-get update

This command will update all the current packages.

3. Run command

sudo apt-get install accountsservice adduser apparmor apt apt-transport-https apt-utils base-files base-passwd bash bash-completion bind9-host dbus debconf debconf-i18n debianutils dh-python python3 python3-apt python3-commandnotfound python3-dbus python3-distupgrade python3-gdbm python3-gi python3-minimal python3-pyinotify python3-systemd python3-update-manager python3.5 python3.5-minimal system

These are all missing packages which are required for installation. So just copy and paste them. It will install all these packages.

4. Run command

apt-get upgrade

This will upgrade all packages and will install new packages but remember that it will not install any missing packages.

So now we are ready for running official Ghost Installation. For this tutorial i am using username "ayush" you can use any username.

Create User


1. Run command

adduser ayush
  1. Run command
usermod –aG sudo ayush

It will provide root access to user ayush.

3. Run command

su – ayush

It will switch your current root user to ayush. So now you will be running all command as user ayush.

Install Nginx Webserver

  1. Run Command
sudo apt-get install nginx

It will install nginx web server on your VPS.

Install & Setup UFW Firewall


1. Run command

sudo apt-get install ufw

It will install UFW firewall on your VPS.

2. Run command

sudo ufw allow 'Nginx Full'

It will allow nginx webserver to pass through UFW firewall.

3. Run command

sudo ufw default deny incoming

This will deny all incoming connections and will only allow specific ports.

4. Run command

sudo ufw default allow outgoing

This will allow all outgoing connections.

5. Run command

sudo ufw allow ssh

This will allow ssh connections to your VPS.

6. Run command

sudo ufw allow 22

This will allow port 22 connection to your VPS using ssh. This is very important step so don’t skip it. If you skip it then you won’t be able to connect to your VPS again.

7. Run command

sudo ufw enable

This will enable firewall on your VPS.
Now we are done setting up firewall for our VPS. It will ask you for confirmation so just press ‘y’ and enter.

Install MySQL Server


1. Run command

sudo apt-get install MySQL-server

This will install MySQL server on your VPS. Your default MySQL username is ‘root’ and set your desired password.

Install Node.js


2. Run command

sudo apt-get install curl

This will install curl on your VPS.

3. Run command

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash

This will download node.js on your VPS.

4. Run command

sudo apt-get install –y nodejs

This will install node.js on your VPS.

So now we have setup a user ayush to run installation, nginx webserver, firewall, MySQL server and node.js

Install Ghost


So what is left now?

Now we have to install Ghost.

  1. Run command
sudo npm i –g ghost-cli

This will install ghost cli on your VPS which is required for running installation.

2. Run command

sudo mkdir –p /var/www/ghost

This will make a directory ghost in which we are going to install our ghost blog.

3. Run command

cd /var/www/ghost

This will navigate you to the directory ghost in which we are going to install ghost.

4. Run command

sudo chown ayush:ayush /var/www/ghost

This will provide directory access to user ayush as a non root user.

5. Run command

sudo chmod 775 /var/www/ghost

This will give permissions to user ayush to install ghost in ghost directory as a non root user.

6. Finally Run command

ghost install

This will start your ghost installation in current ghost directory. Do not run this command as root user or it will not run.

Ghost Prompt


Now follow all the prompt that it gives you.

  1. Ghost Blog URL -: “http://yourwebsiteurl.com” (put https if you have SSL installed or you want to install SSL in next prompt)
  2. Host -: “localhost” (It is default to localhost. So just press enter”
  3. MySQL Username -: “root”
  4. MySQL Password -: “yourpassword” (Enter the password that you set during MySQL server installation)
  5. Ghost User -: “y” (It will setup a default ghost user)
  6. Ghost Database -: “ghost_prod” (Press enter as it’s default database)
  7. Let’s Encrypt SSL -: If you want to setup a SSL for your blog then just press “y” and enter your email. It will setup SSL for your blog.
  8. Setup Nginx -: “y” (It will setup nginx for your blog)
  9. Setup Systemd -: “y” (Do not skip it or press “n” because it runs ghost or if you press “n” for now then you have to setup it manually. So just press “y” and let it install automatically)
  10. Start Ghost -: Ofcourse “y”

    GREAT OUR GHOST BLOG IS NOW RUNNING. SO JUST ACCESS IT BY YOUR URL AND CONFIGURE IT BY GOING TO “yoururl.com/ghost”

I hope you like the tutorial. If you have any suggestions or any problems then comment below or mail me directly at [email protected]

Thanks
Ayush Agarwal
Have a great day.