Upgrading WSL2 to Ubuntu 20.04 and running Jekyll

Written on April 28, 2020

Ubuntu LTS 20.04 just came out, and you can either install into WSL2 from the Windows Store, or if you already had Ubuntu for WSL then you can upgrade that in place using sudo do-release-upgrade -d.

There’s a few confirmation prompts along the way. Eventually you’ll get to a point where it wants to reboot. The trouble is if you try sudo reboot it will complain that you’re not running systemd and give up.

The solution is to jump back to Windows and run wsl --shutdown, then relaunch Ubuntu and it should be happy.

Jekyll

Having a freshly upgraded install of Ubuntu, I thought it was time I got a local copy of Jekyll so I could preview my blog posts.

To ensure that I’m using the same Gems that GitHub Pages use, I updated my Gemfile to just reference the github-pages gem.

source 'https://rubygems.org'

gem 'github-pages'

And then install Jekyll prerequisites:

sudo apt-get install ruby-full
sudo apt-get install build-essential dh-autoreconf
sudo apt install zlibc
sudo apt install libxml2-dev
sudo apt install libxslt-dev

Tell Ruby to install Gems locally (so we don’t need sudo)

echo 'export GEM_HOME=~/.ruby/' >> ~/.bashrc
echo 'export PATH="$PATH:~/.ruby/bin"' >> ~/.bashrc
source ~/.bashrc
gem update

gem install pkg-config -v "~> 1.1"
gem install nokogiri -- --use-system-libraries

bundle install

Categories: Jekyll, Ubuntu, WSL2