UPDATE: Troubleshooting added to the bottom of the page

Don’t Be BASHful

Or is that Be BASHful? I’m not sure. That joke got away from me already.

First order of business:

  • Enable “Bash on Ubuntu on Windows”

That’s right. CLICeption. Managing a Jekyll static site on Windows just got a whole lot easier! This is a fast track setup (no pictures). Assumes you know at least a little about what you’re doing.

Windows Dev Mode

First, enable Windows Dev Mode. Run this in an Elevated PowerShell window:

$DevModeKey = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\AppModelUnlock\'
Set-ItemProperty -Path $DevModeKey -Name 'AllowDevelopmentWithoutDevLicense' -Value 1 -Type DWord
Set-ItemProperty -Path $DevModeKey -Name 'AllowAllTrustedApps' -Value 1 -Type DWord

Now run the App Wizard. Type this in PowerShell:

& appwiz.cpl

Or just Start–> Run –> appwiz.cpl

  • Select Turn Windows features on or off (Left Sidebar)
  • Scroll down and check the box labeled “Windows Subsystem for Linux Beta”
  • Allow your computer to Restart

Upon restart you want to run bash.exe, either from PowerShell or you can hit the Windows key and type “bash.exe”

You will get a terms of service window saying this is a Beta Feature. Type ‘y’ to continue. Don’t back out on me now!

Follow the instructions to create a user account and password. DO NOT use lxrun /install /y. DO NOT use root as your user. JUST DON’T DO IT! Use Sudo.. same as any sane person would on a straight Linux distro.

Now you should have a fully functional “Bash on Ubuntu on Windows” application. Woot!

A Little System Prep

This will update all of your packages, then install git, along with some other tools.

sudo apt-get update && apt-get upgrade
sudo apt-get install build-essential git-core curl

Install Ruby 2.3.1

The system may ask for your password multiple times when RVM wants to start installing packages

Prerequisites:

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev

GPG Key:

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Use curl to get pull down RVM

curl -sSL https://get.rvm.io | bash -s stable

Load RVM on login with .bashrc

echo " " >> ~/.bashrc
echo "# This loads RVM into a shell session." >> ~/.bashrc
echo ". ~/.rvm/scripts/rvm" >> ~/.bashrc

Re-source .bashrc

source ~/.bashrc

Install Ruby via RVM

rvm install 2.3.1

Tell RVM to use 2.3.1 by default. Use ruby -v to verify.

rvm use 2.3.1 --default
ruby -v

After that is done you can install Bundler

gem install bundler

And finally:

Install Jekyll

gem install jekyll

Note: Please keep case in mind with the gem commands. gem install Jekyll -ne gem install jekyll

And that’s it! You’re officially running Jekyll on Ruby on Bash on Ubuntu on Windows.

Bet you never thought THIS day would come! Welcome to the new Microsoft. And I think the party is just getting started.

Note: The RVM section comes from this document: Rails Setup Doc. Visit it for more helpful hints; like how to set up SSH access to GitHub via certificate.

Troubleshooting

Issues:

  • ArgumentError: parent directory is world writable but not sticky:
    • After installing Ruby via RVM and then Bundler, you may get an error when running bundle install
    • To resolve the issue, run this from the BASH prompt: find ~/.bundle/cache -type d -exec chmod 0755 {} +
  • jekyll 3.0.1 Error: Invalid argument - Failed to watch
    • You will get this if you try to run jekyll serve by itself. This is due to the fact that filesystem watchers and inotify support are currently not implemented (but they are on their way!). Check: https://github.com/Microsoft/BashOnWindows/issues/216 for more info.
    • To resolve this issue run jekyll serve -w --force_polling Please note the underscore.

Till next time!