Running Ghost on Ubuntu on Windows
Enabling Ubuntu on Windows
To enable the new Ubuntu in Windows 10 Anniversary Edition; you need to enable developer mode, turn the feature on and finally install Ubuntu on Windows via the Windows Store.
Using Cortana's Search interface, search for
use developer features and ensure
Developer Mode is selected. A restart may be required after enabling, my base VM has this enabled already, so I am not sure.
use developer features
Next search for
turn windows feature on and select the
Windows Subsystem for Linux (Beta) option. Enabling this feature will require a restart.
turn windows feature on
Finally, fire up PowerShell and run the
bash command. This will prompt you to install Ubuntu on Windows via the Windows Store.
Once installed, you will be prompted to create a user account. And you will be dropped into your bash prompt. You are now running bash via the Linux Subsystem on Windows.
Setting Up a General Development Environment
To setup our bash development environment we need to first update our Ubuntu command line tools and install a few more like git, gcc and make.
Start by updating apt using the
sudo apt update command in bash.
sudo apt update
Then upgrade all of the apt installed packages using the
sudo apt upgrade command in bash. Be sure to select
y when prompted.
sudo apt upgrade
Note: This will take a few minutes and throw a bunch of download & install messages to your console. I have omitted these messages from the screenshot for clarity.
Because you will be using node.js and npm on the linux subsystem, you need to ensure that npm will be able to build C source using make. To do this, you need to install gcc and the g++ compilers. You can do this with apt easily. Be sure to select
y when prompted.
sudo apt-get install build-essential
Note: I have once again omitted the download & install messages from the above screenshot.
Finally, you will want to be able to pull source code from github. So install git as well via apt.
sudo apt-get install git
Setting Up a Node.js Development Environment
The stable distribution of Ghost runs on an older version of Node (v0.10). It is nice to be able to switch between various versions of node. So, install NVM the node version manager.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
Then use nvm to install the latest version of node as well as version 0.10.
sudo nvm install stable sudo nvm install v0.10
Setting Up and Running Ghost
Now that the environment is all setup. You can clone the Ghost repository using git. Then switch to the stable branch.
git clone https://github.com/TryGhost/Ghost.git cd Ghost git checkout stable
Ensure that NVM is using the correct version. And install grunt-cli globally.
nvm use v0.10 npm install -g grunt-cli
Then install the ghost dependencies locally with NPM and initialize Ghost with Grunt. Finally fire it up using NPM.
npm install grunt init npm start