During my set-up of Ghost I quickly bumped into issues from incompatibilities from using particular OS and versions of applications. This post is for a quick and easy build of the Ghost blogging platform for anyone else that's keen set-up their own site without the hassle of checking stackoverflow for each obstacle they encounter.
This site is currently hosted on AWS and sitting on a t2.micro server running Ubuntu 16.04. I originally wanted to use CentOS but quickly ran into issues with MySQL and didn't want to go through the hassle of all that. So here's a quick guide on how to set-up Ghost on a Ubuntu server (I'll probably use it again myself cause it was so straight forward)
This tutorial will get you up and running with a live blogging platform in under 15 minutes.
Before you start
- Create a AWS t2.micro ubuntu 16.04 VM with an Elastic IP associated
- Create a Public DNS record and point it at your Public Elastic IP. This is required for the Let's Encrypt SSL Certificate Validation
SSH into your server and run updates to the Ubuntu OS to ensure it has the latest updates.
Note: I'm running the commands from the context of a non-root user.
sudo apt-get update
sudo apt-get upgrade -y
Next, run the following commands to install the pre-requisite applications for Ghost to function: Node.JS, Ghost-cli, nginx & MySQL
Note: During the MySQL Server install, it will prompt you to set a password for the Root account. Remember the password for the Ghost install!
curl -sL deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g ghost-cli
sudo apt-get install nginx
sudo apt-get install mysql-server
Then create the install location for ghost and provide it the required folder and user permissions to ensure we can run the Ghost Install.
Note: In this case I'm using the AWS default login for my server which is ubuntu. Replace ubuntu:ubuntu with youruser:youruser should you have created another user account
sudo mkdir -p /var/www/ghost
sudo chown ubuntu:ubuntu /var/www/ghost/
sudo chmod 775 /var/www/ghost
You will now change to the directory of the ghost folder and run the Ghost install command.
The ghost installer will go through a bunch of simple steps which you are required to provide some input. It will also automate your SSL Certificate deployment and configuration of nginx should you choose so.
Note: Enter your FQDN as HTTPS to prevent mixed-content issues later in the build.
Below is an example of my inputs:
Blog URL: https://blog.timothyduong.me:2368
MySQL hostname: localhost
MySQL username: root
MySQL password: ********
Ghost DB Name: ghostprod
Set-up NGINX: Yes
Set-up SSL: Yes
Set-up "ghost" mysql user? Yes
Start Ghost? Yes
And that's essentially it. From here, you access your blog from the DNS record and to access the admin panel, just add /ghost (E.g. https://blog.domain.com/ghost)