Categories: System Configuration
Tags: node, ruby, jekyll
Reading time: approx. 3 minute(s)
Disclaimer: This article is an update on the previous article regarding (X)ubuntu 14.04. The post is primarily self-documentational and it’s probably not entertaining (at least for the majority of people :)
I reinstalled my work machine from Xubuntu 14.04 to 16.04; I didn’t on purpose do an upgrade but a full install just to start afresh. This is article is just a short updated summary of installing
Installing Node using NVM
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
This will install Node.js Version Manager (NVM) in your home directory (
~/.nvm) and add a few NVM-related initialization lines in your
Install Node and NPM
Next, select and install the version of Node.js that you want to install. You can install multiple versions. You can list all the available versions with
nvm ls-remote. I went with
nvm install 6.3.1
for installing the newest version that was available at the time.
Installing Ruby and Jekyll using rbenv
sudo apt-get update sudo apt-get install git-core zlib1g-dev libssl-dev libreadline-dev
build-essential seemed to not be needed, at least builds succeeded without installing it (and also
dpkg -l | grep build-essential returns nothing).
The following will first clone
~/.rbenv. After that it was add initialization code to your
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Preparing to install Ruby
The following will clone the required stuff to make installing Ruby quick-n-easy. Without the following you won’t have
rbenv install available to you:
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
Finally installing Ruby
Once you’re this far you’re now ready to install Ruby. To list the available version, run
rbenv install --list. Once you’ve selected the version to use (like here I opted to use version
2.3.1), you can run the installation:
rbenv install -v 2.3.1 rbenv global 2.3.1
Notice that the
-v flag is actually not referring to version in this case (as you might think) but is a flag to turn the verbose installation mode on. More info about install flags:
rbenv help install.
Installing Bundler for rbenv
To be able to use
Gemfiles to keep track of dependencies we’ll install Bundler to get to use the
bundle command. We can’t simply install Bundler from where ever but we’ll need an
rbenv related version. Here we go:
git clone https://github.com/carsomyr/rbenv-bundler.git ~/.rbenv/plugins/bundler gem install bundler rbenv bundler on
Here’s a list of the available Jekyll versions. The newest version of Jekyll is currently v3.2.1. Some of my sites break under v3.x though and hence I also want to also use v2.5.3. To install them both:
gem install jekyll -v 3.2.1 gem install jekyll -v 2.5.3
Using Bundler with Jekyll
Gemfile according to what you need. For example on one of my sites I need Jekyll v2.5.x, jekyll-paginate and jekyll-sitemap so my
Gemfile for that site looks like this:
source "http://rubygems.org" gem "jekyll", "~>2.5.3" gem "jekyll-sitemap" gem "jekyll-paginate"
Once you have the
Gemfile created and you run
jekyll serve or
jekyll build, if you get errors, try running this as first resort:
For more info on
Gemfile syntax, see http://bundler.io/gemfile.html.
Gemfile from Jekyll output
Gemfile.lock from Jekyll output in
_site directory by adding this to your Jekyll
exclude: - "Gemfile*"
After a fair amount of frustration,
ruby (2.3.1) and
jekyll (v3.2.1 and v2.5.3) now work correctly, yey!