IT IS TRUE, Jekyll on Android is possible, and the specific focus of our post. However, our purposes are more layered. Allow us to also demonstrate the general usefulness of Termux as we install the popular static site generator onto our budget Motorola Moto E5.

As part of our Code Underground series, our post, at heart, serves underprivileged hackers who must use Android mobile devices as their primary device for reasons of affordability, portability, and lack of more conventional hardware et cetera.

Although mobile devices aren’t ideal workstations, they’re competent computers, the competency of which had been, otherwise, too diminished for our purposes, but here’s where Termux exhibits its brilliance to provide hackers of limited means the power of terminal emulation.

Install Environment

What is Termux? Taken from the official website:

“Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required.”

We rooted our previous Android mobile device—a Nexus 5. Admittedly, it’s not a process we desire to get bogged down in again, nor do we recommend rooting to those new to The Craft, who can’t afford to accidentally brick their primary device.

Therefore, “no rooting or setup required,” was a much welcomed feature, and determinant factor, we were thrilled to have discovered in our search for a suitable terminal emulator. So, without further ado, let’s proceed with the installation instructions.

  1. Open the Google Play Store.

  2. Search for Termux by Fredrik Fornwall, found here: https://play.google.com/store/apps/details?id=com.termux

  3. Install Termux.

  4. Open Termux and run pkg update.

  5. Optionally, run uname -r to return the current kernel version, which should look something like: 3.18.71-perf-gb8387629fde3-00107-g84333c038287.

For more on Termux, see the documentation: https://wiki.termux.com/wiki/Main_Page

Install Dependencies

Based on the quality of our network connection, we might want to install these next packages one by one. If in case we drop the connection, then we’d have a clear idea of what’s missing, and should run apt -f install to fix the missing dependencies.

  1. In Termux, run pkg install ruby clang make libffi.

  2. Run pkg install autoconf build-essential.

For more on Ruby, see the documentation: https://www.ruby-lang.org/en/documentation/

Install Jekyll

“Jekyll is a Ruby Gem that can be installed on most systems.”

From our experience, Jekyll proved the most problematic point of the process. We couldn’t get Jekyll 4.0.0 to work with Termux 0.94, so we used an older version of Jekyll—3.8.6.

Jekyll took about 15 minutes to install on our device. So, troubleshooting the installation was extra tiresome after a handful of failed attempts. In the interest of time, “How to Upgrade to Jekyll 4 on Android” is something we can consider later.

  1. Run gem install bundler

  2. Run gem install jekyll --version 3.8.6

For more on Jekyll, see the documentation: https://jekyllrb.com/docs/

Patch Jekyll 3.8.6

Unfortunately, we encountered the following server error:

Error: Permission denied @ rb_sysopen - /proc/version

We need to edit a file named platform.rb. To find the file and fix the error:

  1. Follow the directions found in the comment here: https://github.com/jekyll/jekyll/issues/7045#issuecomment-394071569
  • The linked comment used the deprecated command bundle show jekyll. Instead, use bundle info jekyll to avoid confusion.

Create Our Jekyll Blog

It should also be noted, we experienced lots of the following warnings when generating our blog, running Ruby 2.7.1, but it’s nothing to be overly concerned about:

warning: Using the last argument as keyword parameters is deprecated

  1. If we run pwd we should be in the /data/data/com.termux/files/home directory.

  2. If the home directory is where we’d like to locate our Jekyll blog, then run jekyll new example, else cd to our directory of choice. Of course, “example” can be named whatever we prefer instead.

  3. Run cd example.

  4. Run bundle exec jekyll serve.

  5. Open the Mozilla Firefox browser.

  6. Go to http://127.0.0.1:4000 to view our new Jekyll blog.

Configure Our Jekyll Blog

Our homepage is located at 127.0.0.1:4000, all well and good. However, the default path segment for our blog is branded, i.e. 127.0.0.1:4000/jekyll.

In order to change the default to something more contextual, like 127.0.0.1:4000/blog:

  1. Run pkg install nano.

  2. Run nano _config.yml.

  3. Type permalink: /blog/:year/:month/:day/:title/ at the bottom of the file.

  4. Press Ctrl+X to exit the file.

  5. Select Y and then press Enter to save.

Additional Resources

Clang https://clang.llvm.org/

Make https://www.gnu.org/software/make/

libffi https://sourceware.org/libffi/

Autoconf https://www.gnu.org/software/autoconf/autoconf.html