Jekyll is a blog aware static website generator written in Ruby that converts Markdown files into static HTML files. It supports many Markdown interpreter here are some of them RDiscount , Maruku, Kramdown and RedCarpet. Jekyll stores its configuration in a _config.yml
file that contains information about how to build the static website and which module and plugins should be used, It is one of the most widely used static website generators. It is recommended due to its popularity and large community support and active development.
It also supports plugin to add more functionality and extensions that are not available by default, these plugins can be written in Ruby and can be placed under the _plugins
folder, The file must end with the .rb
extension. Any file placed under the ‘_plugins’ folder will be loaded before the website is generated.
It is available as a Ruby gem that installs with its dependencies, it is easy and fast in terms of usage and performance.
Here is how you can get It running on your Raspberry Pi. We will be compiling Ruby 2.1.2 using RVM, we also would be installing Node.js to avoid the ExecJS issue, I have chosen Node.js over the ‘TheRubyRacer’ gem because Node.js is faster more stable and installs in a shorter time than ‘TheRubyRacer’, If you want a pure Ruby based Jekyll setup you can skip the Node.js install step and go with ‘TheRubyRacer’ gem, It’s all based upon personal preference. The big reason I am compiling Ruby is that I prefer the latest version of Ruby and compiling Ruby make Jekyll and other Ruby stuff, even more, faster due to adaptation to the CPU cycles. I highly recommend not to overclock you Raspberry Pi over 800 MHz as this process uses means of compiling and might cause damage if you don’t have a stable source of power supply.
I have used PiBang Linux Server Edition, but you can use Raspbian. PiBang Linux is based on Raspbian but it does not come with the extra educational software that Raspbian offers, PiBang Linux Server does not come with GUI or Xorg. I have used SSH to follow the instruction below.
Installing
Updated: This method is for Debian Jessie or newer release.
sudo apt-get update
Code language: JavaScript (javascript)
sudo apt-get install software-properties-common
Code language: JavaScript (javascript)
sudo apt-get install ruby-full
Code language: JavaScript (javascript)
sudo gem install jekyll
sudo gem install bundler
If you prefer compiling Ruby, follow the setup below.
We need to first install RVM on our Raspberry Pi.
\curl -sSL https://get.rvm.io | bash -s stable
Code language: JavaScript (javascript)
Once RVM is installed we need to exit the terminal.
/bin/bash --logout
Now RVM can be executed.
We can now fetch dependencies needed to compile Ruby on Raspberry Pi. This command will ask you for your user password by default on Raspbian it’s. raspberrypi
If you are I PiBang Linux user it depends on what you have set as the password while going through the setup screen, You have to enter the password of the user you what to log in as.
rvm requirements
Once we have the build essential and the required packages for compiling Ruby on our Raspberry Pi, we can now install Ruby. 2.1.2
is the current latest version of Ruby at the time of this post being published. Installation of Ruby will take a least 2 hours or more depending on the internet connection and clock speed.
rvm install 2.7.1 # installing Ruby
Code language: CSS (css)
rvm install 2.7.1 # installing Ruby
Now that we have Ruby installed, we can now finally install Jekyll. By choosing not to install ri
and rdoc
we are saving time and avoiding installing thing we don’t require.
gem install jekyll --no-ri --no-rdoc
To avoid the ‘ExeJS’ error we need to install Node.js on your Raspberry Pi. A precompiled version of Node.js is already available for the Raspberry Pi. You can install Node.js by reading this post. If you want to build Jekyll based website purely using Ruby you can install TheRubyRacer
gem. TheRubyRacer takes a lot of time to as it needs to build native extensions.
gem install therubyracer --no-ri --no-rdoc
Now we can create our Jekyll project/website.
jekyll new website # jekyll new
Code language: PHP (php)
Now you can get into the directory.
cd website/
Once you are in the directory you can start the Jekyll preview server.
jekyll serve
You can now enter your Raspberry Pi IP address with the port set to 4000
example.
http://192.168.1.2:4000
Code language: JavaScript (javascript)
You will get Jekyll running with its stock setup on your web browser.
You can edit the _config.yml
and customize the website. You can read the Its documentation and learn more about customization over here.
You can deploy your static website that we just created using ‘Glynn’ or ‘Git’, It depends all on you.
Now we have Jekyll installed on our Raspberry Pi. Thanks for reading and feel free to subscribe using RSS. If you have any problem, feel free to leave a comment below.