n3s0 || journal

Install and Configure Jekyll on OpenBSD

Posted on 5 mins

OpenBSD Jekyll Install

Overview

These are some notes from some fun I had while installing and configuring Jekyll on OpenBSD 7.0-current. The installation wasn’t bad. I just want to document for future use.

I use Jekyll for building static sites that are hosted on and off the Internet. The best part about it is it’s useful and it’s free. Some themes you have to pay for. Others you don’t have to pay a dime to use. They’re the low low cost of free.

Included is a link to the Jekyll website in case it sparks interest with anyone reading this.

There are a couple of components involved with installing Jekyll. Such as Ruby. Though, I have notes on installing Ruby on OpenBSD 7.0-Current also. I will cover that in the section where I talk about installing Ruby. Luckily, Ruby is the only thing that needs to be installed and configured for the time being.

Dependencies

Like I mentioned, the only dependency for Jekyll that I’ve seen so far is Ruby. I haven’t come accross anything else that I may need to install. Other than the Ruby Gems after the fact.

Installing Ruby

Installing Ruby isn’t too difficult on OpenBSD. As long as you read the documentation after installing it, it’s a pretty seemless process. I have another page specifically for installing Ruby at the link below. This is required before Jekyll is installed.

Once Ruby gets installed, I can start with the installation of Jekyll. I will go over that in the next section.

Installing Jekyll

Installing Jekyll is pretty simple. It’s a Ruby gem that gets installed and goes into the path $HOME/.gem/ruby/3.0/bin. There are some steps associated with it before it works the way you want it though.

The following will install the needed components for Jekyll and Bundler. Bundler is used as a gem management tool used to provide all of the needed gems/libraries so Jekyll can run the say it should.

gem install --user jekyll jekyll-feed jekyll-seo-tag minima bundler

Now it’s time to configure symbolic links for all of the gems. This can be done using the ln(1) command. This will set the name to it’s originally respective name. As opposed to e.g. jekyll30.

ln -sf $HOME/.gem/ruby/3.0/bin/jekyll30 $HOME/.gem/ruby/3.0/bin/jekyll
ln -sf $HOME/.gem/ruby/3.0/bin/bundler30 $HOME/.gem/ruby/3.0/bin/bundler
ln -sf $HOME/.gem/ruby/3.0/bin/bundle30 $HOME/.gem/ruby/3.0/bin/bundle
ln -sf $HOME/.gem/ruby/3.0/bin/kramdown30 $HOME/.gem/ruby/3.0/bin/kramdown
ln -sf $HOME/.gem/ruby/3.0/bin/listen30 $HOME/.gem/ruby/3.0/bin/listen
ln -sf $HOME/.gem/ruby/3.0/bin/rougify30 $HOME/.gem/ruby/3.0/bin/rougify
ln -sf $HOME/.gem/ruby/3.0/bin/safe_yaml30 $HOME/.gem/ruby/3.0/bin/safe_yaml

Now it’s time to add the BUNDLE_PATH variable to the shell. This can also be added to the rc file for the shell being used. In my case, I added it to the .zshrc file. without it, gems may not install.

export BUNDLE_PATH=$HOME/.gem/ruby/3.0/gems

Now that Jekyll is installed, it’s time to build a new site and test.

Get Started Using Jekyll

First, the directory for the site needs to be created. This can be done by using the mkdir(1) command. This will create a new directory named myblog that the site will go into.

mkdir myblog

Build the new blog using the jekyll command in the myblog directory.

jekyll new myblog

Below is the output from generating the new blog. This will scaffold everything needed to serve a new blog locally on the computer.

Running bundle install in /home/example/testing/myblog...
  Bundler: Fetching gem metadata from https://rubygems.org/..........
  Bundler: Resolving dependencies....
  Bundler: Using public_suffix 4.0.6
  Bundler: Using bundler 2.2.33
  Bundler: Using colorator 1.1.0
  Bundler: Using concurrent-ruby 1.1.9
  Bundler: Using eventmachine 1.2.7
  Bundler: Using http_parser.rb 0.8.0
  Bundler: Using forwardable-extended 2.6.0
  Bundler: Using rb-fsevent 0.11.0
  Bundler: Using rexml 3.2.5
  Bundler: Using liquid 4.0.3
  Bundler: Using ffi 1.15.4
  Bundler: Fetching rouge 3.27.0
  Bundler: Using mercenary 0.4.0
  Bundler: Using safe_yaml 1.0.5
  Bundler: Using unicode-display_width 1.8.0
  Bundler: Using addressable 2.8.0
  Bundler: Using kramdown 2.3.1
  Bundler: Using i18n 1.8.11
  Bundler: Using pathutil 0.16.2
  Bundler: Using sassc 2.4.0
  Bundler: Using rb-inotify 0.10.1
  Bundler: Using terminal-table 2.0.0
  Bundler: Using em-websocket 0.5.3
  Bundler: Using kramdown-parser-gfm 1.1.0
  Bundler: Using jekyll-sass-converter 2.1.0
  Bundler: Using listen 3.7.0
  Bundler: Using jekyll-watch 2.2.1
  Bundler: Installing rouge 3.27.0
  Bundler: Using jekyll 4.2.1
  Bundler: Using jekyll-feed 0.15.1
  Bundler: Using jekyll-seo-tag 2.7.1
  Bundler: Using minima 2.5.1
  Bundler: Bundle complete! 6 Gemfile dependencies, 31 gems now installed.
  Bundler: Bundled gems are installed into `/home/example/.gems/ruby/3.0/gems`
New jekyll site installed in /home/example/testing/myblog.

Change directories into the myblog directory.

cd myblog

Run the Jekyll site. Though, this may fail. The Webrick library is required in the Jekyll project Gemfile so the server can run. Webrick in essance is the http or https server library that acts as a dependency. It’s noted in Jekyll’s official documentation that it’s a dependancy of Jekyll.

It isn’t needed when you install Jekyll on Ruby 2. But, it is when you do with Ruby 3. May be worth noting that I included this as a “Troubleshooting Tip” in the link found in resources.

bundle exec jekyll serve

Suspected output can be found below.

Configuration file: /home/example/testing/myblog/_config.yml
            Source: /home/example/testing/myblog
       Destination: /home/example/testing/myblog/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       Jekyll Feed: Generating feed for posts
                    done in 2.179 seconds.
  Please add the following to your Gemfile to avoid polling for changes:
    require 'rbconfig'
    if RbConfig::CONFIG['target_os'] =~ /(?i-mx:bsd|dragonfly)/
      gem 'rb-kqueue', '>= 0.2'
    end
 Auto-regeneration: enabled for '/home/example/testing/myblog'
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

Resources: