Installing Ghost

Don't worry you don't need to call the ghost busters! Ghost is a simple, open source, platform for modern blogging. In fact this site itself is running off of Ghost

2 years ago

Latest Post Cloud Development Kit for Kubernetes (cdk8s) by Tyler Moon

Don't worry you don't need to call the ghost busters! Ghost is a simple, open source, platform for modern blogging. In fact this site itself is running off of Ghost and so that is why this first post will explain now to get an instance of Ghost up and running.


Once you have assembled all the above resources you are ready to dive into installing the server.

Preparing Server

Depending on your server provider and server type there may or may not be the following already installed. After using SSH to connect to the server, run the following Ubuntu commands (or their equivilent for other Linux Distros) to install the needed software for supporting Ghost.

Update Ubuntu to the latest

sudo apt-get update

Install MySQL Database to store your content

sudo apt-get install mysql-server

Connect to the newly installed MySQL server and create a new user for Ghost

sudo mysql
mysql> CREATE USER 'ghost'@'localhost' IDENTIFIED BY '<make_up_a_password';
mysql> GRANT ALL PRIVILEGES ON * . * TO 'ghost'@'localhost';

Then use exit to exit MySQL

Install Nginx as a reverse proxy server

sudo apt-get install nginx

Start Nginx and enable it on system restart

sudo systemctl start nginx
sudo systemctl enable nginx

Node.js and NPM
Install Node.js and NPM

sudo apt-get install nodejs
sudo apt-get install npm

After completing these steps you should be able to now install Ghost

Installing Ghost

First we are going to need to download the ghost-cli tool which will configure and run the needed server.

sudo npm i -g ghost-cli

Next create a directory to hold the installed files

mkdir /var/www/ghost

Then change the ownership and permissions of the newly created directory

sudo chown $USER:$USER /var/www/ghost && chmod 775 /var/www/ghost

Change directory to the new ghost directory

cd /var/www/ghost/

And now use the ghost cli that we just installed to install the ghost server and download the needed files

ghost install

Once the files are downloaded and installed there will be a series of prompts to configure the new instance

? Enter your MySQL hostname: *localhost*
? Enter your MySQL username: *ghost*
? Enter your MySQL password: *password that was set in mysql install*
? Enter your Ghost database name: *ghost_prod*

After that Ghost will finish setting up and configuring it then a few more prompts will show up. The first is to setup a mysql user which we already did so there is no need for it here. Then the installer will setup the needed configuration files for the Nginx proxy server which is great because those configs can be a pain to setup manually. Next the installer will ask to setup SSL for you via the Let's Encrypt certbot which is also convienent because it can be tricky to manully configure SSL certificates. Finally the setup will configure Systemd so that Ghost can run in the background without a user logged in. Without this the server would shut off when you disconnect the SSH session.

? Do you wish to set up "ghost" mysql user? *No* // We already did
? Do you wish to set up Nginx? *Yes*
? Do you wish to set up SSL? *Yes*
? Enter your email (used for Let's Encrypt notifications) **
? Do you wish to set up Systemd? Yes
? Do you want to start Ghost? Yes

After answering yes to the final prompt your new Ghost server should be up and running on the domain name that you configured!

Tyler Moon

Published 2 years ago