How to Install Jekyll in Alpine Linux

I have been using alpine linux because it is a lightweight Linux distro and highly customizable. I was trying to install jekyll in alpine and following the instruction from jekyll website was not that helpful because the instructions are not for alpine linux. So here is how I did it.

Installing ruby

Official documentation asks that the system has ruby installed and should be version 2.2.5 or higher. Trying to install ruby with the command

sudo apk add ruby

did not help. It was showing some error messages. So as I ventured into the internet I have found that jekyll also need ruby-dev and to make sure that you have ruby documentation and while installing it doesn’t show an ERROR message. I tried the following

sudo apk add ruby-full ruby-dev

Installing dependencies

Jekyll requires gccg++ and make. Installing these were simple

sudo apk add gcc g++ make

Installing Jekyll

After all the dependencies are met it’s easy to install jekyll

sudo gem install jekyll bundler

Running Jekyll

Build the site and make it available on a local server

bundle exec jekyll build

To have a clean build

bundle exec jekyll clean
bundle exec jekyll build

To see the progress and build in realtime and regenerate with each change in source code

bundle exec jekyll serve

Browse

Now browse to http://localhost:4000

 

Enjoy!