I've always had a website. The purposes have varied but I've always had one running. My first website ran on Wordpress and it's taken quite some to to leave that ecosystem. While WordPress has taught me a lot about web, it's time for a meaningful upgrade.

Let's setup Ghost!


I chose to host my blog on DigitalOcean. Here are some reasons why.

  • It's fast.
  • I adore their branding.
  • It's Dependable.

I've hosted hundreds of servers over the years and I've always graviated towards using DO. I also utilize Vultr from time to time.

Setting up the server

I use this guide on the DO community wiki, it works for Ubuntu 18.04 LTS too. Here is my abbreviated version.

Initial Setup

Update system packages.

sudo apt update && sudo apt upgrade -y && sudo apt dist-upgrade -y && sudo apt autoremove -y

Create a new user.

adduser brendan

Sudo that new user.

usermod -aG sudo brendan

Switch over to our new Sudo user.

su - brendan

Create directory and set permissions for ssh.

mkdir ~/.ssh
chmod 700 ~/.ssh

Copy your public key and paste it here.

nano ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

Add permission restrictions to ssh.

chmod 600 ~/.ssh/authorized_keys

Allow OpenSSH through firewall.

sudo ufw allow OpenSSH

Then enable the firewall.

sudo ufw enable

Before you continue
Make sure you have done the following

  • Purchase a domain and redirect it to your server IP.

Now that we have our domain, let's continue with the Ghost instillation.

Installing Ghost

Install nginx and enable it. The latter command is sometimes not needed but I like to run it for good measure.

sudo apt install nginx -y && sydo systemctl enable nginx.service


Install MariaDB

sudo apt-get install mariadb-server mariadb-client && sudo systemctl enable mariadb.service

Setup MariaDB

sudo mysql_secure_installation
  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y

Let's start setting up the database by logging into it first

sudo mysql -u root -p

Create what we need for ghost, == remember to change what you need! ==

CREATE USER 'ghostuser'@'localhost' IDENTIFIED BY 'new_password_here';
GRANT ALL ON ghost.* TO 'ghostuser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

Installing NodeJS

Ghost only supports NodeJS 8.x as of May 2018

cd ~ && curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

Install NodeJS

sudo apt-get install nodejs

Installing Ghost

The next steps assume that we are using your sudo user account to manage ghost. While some guides on the net have you use a ghost specific user, I'll just be using my sudo user brendan.

Create Ghost directory

sudo mkdir -p /var/www/html/ghost/

Set permissions of our install folders = Change the username below =

sudo chown -R brendan:brendan /var/www/html/ghost;
sudo chmod -R 755 /var/www/html/ghost;

Install Ghost

cd /var/www/html/ghost;
sudo npm i -g ghost-cli;
ghost install;

External Links