We recently published Ubuntu to the Windows Store. With the switch from beta to GA, I found myself with a beautifully pristine Ubuntu environment to rebuild. I decided to take advantage of this oportunity and document some of the configuration challenges I faced. I worked around these issues in the beta as well but it happened in drips and drabs making it hard to coherently document.
This post covers getting Ruby 2.1.1 installed and running. I don’t do much with Ruby but my blog is built on top of a Ruby package called Jekyll. While most of the heavy lifting is done behind the scenes on GitHub using GitHub pages, I find it extremely helpful to have a local copy. And since Jekyll is notoriously tricky to get up and running on Windows, the Windows Subsystem for Linux is a really elegant solution.
If you’re not already using Ubuntu from the Store, I highly recommend reading Scott Hanselman’s Ubuntu now in the Windows Store: Updates to Linux on Windows 10 and Important Tips.
Default Package Repo
Ruby is included in Ubuntu’s default package list but it will install Ruby v1.9.3 which is an outdated version and not supported by GitHub Pages and Jekyll. This isn’t an uncommon issue with a distro package repositories so you often find yourself pulling packages direction from the vendor. Ruby however turned out to be a bit trickier to sort out for a lowly Windows Dev like myself. ;)
We’re going to be installing several packages here using
apt. Before doing that, it is always a good idea to refresh your package index:
sudo apt-get update
Before we can install Ruby 2.1.1, we need to first install some dependencies. Executing the following command line will get that ball rolling:
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
rvm using the following commands:
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 curl -sSL https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm
Installing Ruby 2.1.1
Now what we have all of the prerequisites installed, we can install the actual Ruby package. While some of the previous commands were a bit opaque to me, it is this last bit that I found attractive about
rvm. This portion is extremely straight forward:
rvm install 2.1.1 rvm use 2.1.1 --default ruby -v
Note that this does take a while to download, configure, and compile. It isn’t as simple as installing some small binaries.
This bit I like about this is that how easily I can switch versions. If I decide I would rather use the most current Ruby 2.4.1 I can simply install it and switch to that as my default:
rvm install 2.4.1 rvm use 2.4.1 --default ruby -v
One this was done, I was able to get Jekyll installed using
gem install jekyll bundler
Below is the complete command list as a Gist