This post will detail how to set up a new VM in google compute engine to run Ghost. I was writing this while setting up this blog's server, if I'm missing anything let me know! These steps were based on a combination of Installing Ghost Deploying Ghost and Using a custom domain.
Updated: I've created a shell script to do all of this for you. See https://github.com/steveniemitz/gce-ghost. All you need to run now is
curl https://raw.githubusercontent.com/steveniemitz/gce-ghost/master/install-ghost.sh | sh
The steps below are roughly what the script runs.
Start by making a new VM in your developer console. I chose a f1-micro instance, debian-7 as the image, and give it a new static IP address. You'll also want to check "allow HTTP" to automatically create a firewall rule for HTTP in.
SSH into your new instance. You can do this either by adding a new private key when setting up the instance, or the "SSH" link in the menu.
unzip, which is not installed by default. First update your packages via
sudo apt-get update, then install it via
sudo apt-get install unzip.
From your home directory (
cd ~) download the latest ghost package.
curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip
Make a place for ghost, I chose
/var/www/ghostsince it's the default in a later step.
sudo mkdir -p /var/www/ghost
Create a new user for ghost, we'll use this later.
sudo useradd -r ghost -U
Unzip ghost into this new directory.
sudo unzip -uo ~/ghost.zip -d /var/www/ghost
Change the owner of that new directory to ghost:ghost
sudo chown -R ghost:ghost /var/www/ghost
sudo apt-get install nodejs
nodejs. Debian doesn't allow
nodeby default, run this to set up a symlink.
sudo update-alternatives --install /usr/bin/node nodejs /usr/bin/nodejs 100
Get npm (which doesn't have a package in wheezy)
curl https://www.npmjs.org/install.sh | sudo sh
Install build-essential package. This is needed to build sqlite3
sudo apt-get install build-essential
Set it up
npm install --production npm start
Now kill the server with Ctrl+C twice once the first start is complete
Set up an init script for ghost
sudo curl https://raw.githubusercontent.com/TryGhost/Ghost-Config/master/init.d/ghost -o /etc/init.d/ghost sudo chmod 755 /etc/init.d/ghost
Start ghost via the init script
sudo service ghost start
Set ghost to auto-start on boot
sudo update-rc.d ghost defaults sudo update-rc.d ghost enable
Install nginx and follow the instructions
At this point you should have a fully functional ghost install running on google compute engine!