Skip to content

Instantly share code, notes, and snippets.

@Trailingslashes
Last active December 12, 2018 21:50
Show Gist options
  • Save Trailingslashes/03b442c57d78f739233099d35fdb041d to your computer and use it in GitHub Desktop.
Save Trailingslashes/03b442c57d78f739233099d35fdb041d to your computer and use it in GitHub Desktop.

Prerequisites

Ubuntu 16.04 or Ubuntu 18.04

MySQL

NGINX

Systemd

Recommended Node version installed via NodeSource

At least 1GB memory (swap can be used)

A non-root user for running ghost commands

If you are running 1GB of memory, you need swap space.

dd if=/dev/zero of=/var/swap bs=1k count=1024k mkswap /var/swap swapon /var/swap echo '/var/swap swap swap defaults 0 0' >> /etc/fstab

If the last command fails with "Permission denied" (e.g. on a fresh Amazon EC2 instance), try this instead:

echo '/var/swap swap swap defaults 0 0' | sudo tee -a /etc/fstab

Server setup

Add a user to run ghost commands

adduser usermod -aG sudo su -

sudo apt-get update sudo apt-get upgrade sudo apt-get install nginx

If you enabled ufw

sudo ufw allow 'Nginx Full' sudo apt-get install mysql-server

If you are running Ubuntu 18.04, you will need to run a couple of additional steps in order to make your MySQL setup compatible

with Ghost-CLI replace 'password' with a password of your choice

sudo mysql ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''

Install nodejs

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash sudo apt-get install -y nodejs

If you have Node.js already installed, please ensure it was installed system wide. This means Node.js was installed e.g. in

/usr/bin/node or /usr/local/bin/node. You can double check where Node.js was installed with the command (which node).

Install Ghost

sudo npm i -g ghost-cli@latest

Create a folder for ghost

sudo mkdir -p /var/www/ghost

Your user must own this directory with correct permissions

sudo chown [user]:[user] /var/www/ghost sudo chmod 775 /var/www/ghost

Navigate to the new folder

cd /var/www/ghost ghost install

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment