How to install Ruby (and Jekyll) on Chromebook
For several years I have been using Jekyll as a platform for my site, and for publication I use a simple GitHub Action which converts an issue into a markdown file which is then processed by Jekyll (in one of the next posts I will also explain this method). I recently had to make some changes to the layout and, to test the changes locally I needed to install Ruby and Jekyll: but since I don’t like doing things in a simple way, I decided to try making the changes from a Chromebook, using the Linux container (Crostini) provided by ChromeOS.
However, I realized that the version of Ruby that comes with Debian 12 installed on Crostini is a bit outdated, so I had to find a reliable way to update it (without installing Arch on Crostini).
After some testing with rvm
, I found the fastest solution using rbenv
.
Below are the steps I followed, but before installing any new software, it’s good practice to update your system’s package list, so execute:
sudo apt update && sudo apt upgrade -y
Install Required Dependencies
Several dependencies ust be installed:
sudo apt install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev software-properties-common -y
Install Ruby
We will use rbenv to install and manage Ruby versions. Install rbenv and ruby-build:
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
Now, install the latest stable version of Ruby:
rbenv install 3.3.1
rbenv global 3.3.1
ruby -v
It may take some time:
andrea@penguin:~$ rbenv install 3.3.1
==> Downloading ruby-3.3.1.tar.gz...
-> curl -q -fL -o ruby-3.3.1.tar.gz https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.1.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 21.0M 100 21.0M 0 0 8488k 0 0:00:02 0:00:02 --:--:-- 8490k
==> Installing ruby-3.3.1...
-> ./configure "--prefix=$HOME/.rbenv/versions/3.3.1" --enable-shared --with-ext=openssl,psych,+
-> make -j 2
-> make install
==> Installed ruby-3.3.1 to /home/andrea/.rbenv/versions/3.3.1
NOTE: to activate this Ruby version as the new default, run: rbenv global 3.3.1
andrea@penguin:~$ rbenv global 3.3.1
andrea@penguin:~$ ruby -v
ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux]
Install Bundler and Jekyll
Bundler is a tool that manages Ruby gem dependencies. Install it with the following command:
gem install bundler
And finally, Jekyll:
gem install jekyll