Ghost is basically an open source headless node.js CMS (very very lightweight). I could have have used WordPress but since i have used iy so many times I thought i would give Ghost a try and see what it has to offer, plus I heard loads of people like the simple UI it has to offer.
- Ubuntu 16.04 or Ubuntu 18.04
- NGINX (minimum of 1.9.5 for SSL)
- A supported version of Node.js
- MySQL 5.5, 5.6, or 5.7 (not >= 8.0)
- A server with at least 1GB memory
- A registered domain name
The first thing we would need to do is grab a domain name, I normally use namecheap.com for all my domain names and often use their hosting services if I need to spin up a quick WordPress site.
Once you have your domain name sorted yon can head over to Digital Ocean and setup your account.
Once you have your account setup you have two options:-
- The Easy way which is a one click application setup you can install from the Digital Ocean MarketPlace
- The "Harder" option where you have to setup a Ubuntu VPS and input all the setup parameters.
If you want to go down the easy route then click on this link https://marketplace.digitalocean.com/apps/ghost and follow the instructions on that page.
Once you have logged in to your newly create Digital Ocean account you will need to setup a "Droplet" which is a VPS (Virtual Private Server)
To configure the droplet, click the "Droplets" tab, and click the "Create Droplet" button.
Here, we will need to select the, Ubuntu 18.04.3, then select the starter plan and scroll to the left and select the VPS specs you would like to configure, Ghost will run very smoothly on the $5 per month VPS but I went for the $10 so I wont have any issues down the line, in any case you can scale out the server if need be.
Once the Droplet has been setup you will receive an email with the root password and IP address, it is important to note that in order for your domain name to resolve to your new website you will need to setup an A record for www and also the root domain so it points your new public droplet public IP address.
Now that you have your new shiny droplet up and running it is time to configure the server in order to install and run Ghost.
Create a new user 🧔
Open up your favotuie terminal (mine is Putty) and login to your new server as the root user
# Login via SSH root@your_droplet_ip # Create a new user and follow prompts adduser <user>
# Add user to superuser group to unlock admin privileges usermod -aG sudo <user> # Then log in as the new user su - <user>
Updating Packages 📦
We also have to ensure all package lists and installed packages are up to date.
# Update package lists sudo apt-get update # Update installed packages sudo apt-get upgrade
Installing NGINX ☁️
Ghost uses an NGINX server and the SSL configuration requires NGINX 1.9.5 or higher, we will be also setting up a free SSL Certificate with Lets Encrypt.
# Install NGINX sudo apt-get install nginx
If you are running a firewall on Ubuntu you also need to apply the following command
sudo ufw allow 'Nginx Full'
Installing MySQL 📁
MySQL will be used for the Ghost backend database
# Install MySQL sudo apt-get install mysql-server
MySQL on Ubuntu 18.04
# To set a password, run sudo mysql # Now update your user with this password # Replace 'password' with your password, but keep the quote marks! ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; # Then exit MySQL quit # and login to your Ubuntu user again su - <user>
Installing node.js 🧬
You will need to have a supported version of Node installed system-wide in the manner described below. If you have a different setup, you may encounter problems.
# Add the NodeSource APT repository for Node 10 curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash # Install Node.js sudo apt-get install -y nodejs
Installing Ghost-CLI 🖥️
Ghost-CLI is a commandline tool to help you get Ghost installed and configured for use, quickly and easily. The npm module can be installed with npm.
sudo npm install ghost-cli@latest -g
Installing Ghost 👻
Once your server is correctly setup and the ghost-cli is installed.
First off we have to setup the directory structure
# We'll name ours 'ghost' in this example; you can use whatever you want sudo mkdir -p /var/www/ghost # Replace <user> with the name of your user who will own this directory sudo chown <user>:<user> /var/www/ghost # Set the correct permissions sudo chmod 775 /var/www/ghost # Then navigate into it cd /var/www/ghost
Once that has been done we can then proceed to install ghost
and there you have it, if all went to plan you should be presentend with your newly setup website. In part 2 we shall be looking on how to secure your site with an SSL Certificate for multiple domain records.
If you run into any issues please reach out to me using the Discuss comments section below.