Chef 14.10 ARM on the BeagleBone/Raspberry Pi

Chef

UPDATE: The latest builds and instructions are now at the 32-bit Arm Chef Infra and Cinc Client Builds for Linux landing page.

I blogged previously about building Chef 14 on the BeagleBone Black and I wanted to revise the instructions to cover both ARMv6l and ARMv7l builds with the BeagleBone Black and Raspberry Pi Zero respectively.

CHEF 14.11 INSTRUCTIONS ARE NOW AVAILABLE

Overview

The Chef client is packaged with Omnibus, which builds the application and all of its runtime dependencies with the Omnibus-Toolchain. Omnibus is built with Ruby, so the instructions need to start with building Ruby. These instructions follow the Installing Debian 9 on a BeagleBone Black and the Installing Raspbian 9 on a Raspberry Pi Zero, so the Debian machines are ready for use.

Preparation

There are several preparatory steps that need to be done before we get started. As the root user update to ensure the latest packages are installed and install the prerequisites for building Ruby and Omnibus-Toolchain.

apt-get update
apt-get upgrade
apt-get install -y autoconf fakeroot git libreadline-dev libssl-dev zlib1g-dev

Add the omnibus user for performing the builds.

useradd omnibus

Create and set permissions on the directories used for the upcoming builds.

mkdir /home/omnibus
mkdir /var/cache/omnibus
mkdir /opt/omnibus-toolchain
mkdir /opt/chef
chown omnibus:omnibus /home/omnibus
chown omnibus:omnibus /var/cache/omnibus
chown omnibus:omnibus /opt/omnibus-toolchain
chown omnibus:omnibus /opt/chef

Ruby 2.6.0

Omnibus is built with Ruby 2.6.0, so as the omnibus user we will install it with rbenv.

sudo su - omnibus
bash

We don’t need documentation for our gems.

echo 'gem: --no-document' >> ~/.gemrc

Let’s install rbenv and add it to our PATH.

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

Install the ruby-build plugin to make it easier to manage different Ruby versions.

mkdir plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
rbenv install 2.6.0
rbenv global 2.6.0
eval "$(rbenv init -)"

Omnibus-Toolchain

Now that Ruby is installed, let’s build and install the Omnibus-Toolchain as the omnibus user.

cd
git clone https://github.com/chef/omnibus-toolchain.git
cd omnibus-toolchain
bundle install --without development
bundle exec omnibus build omnibus-toolchain -l internal

Once this build has completed, as the root user remove the working directory and install the new omnibus-toolchain package.

rm -rf /opt/omnibus-toolchain
dpkg -i ~omnibus/omnibus-toolchain/pkg/omnibus-toolchain*deb

There is a bug in the version of tar provided by Omnibus, so let’s use Debian’s built-in version.

rm /opt/omnibus-toolchain/bin/tar

Chef 14.10

With omnibus-toolchain installed, we can reset our PATH and build Chef as the omnibus user.

cd
export PATH="/opt/omnibus-toolchain/bin:$PATH"
wget https://github.com/chef/chef/archive/v14.10.9.tar.gz
tar -xzf v14.10.9.tar.gz
cd chef-14.10.9/omnibus/
bundle install --without development
bundle exec omnibus build chef -l internal

This usually takes several hours on these limited 32-bit ARM machines.

Installing Chef 14.10

Once the builds have completed, as the root user we can delete the working build directory.

rm -rf /opt/chef

Now Chef 14.10.9 can be installed.

dpkg -i /home/omnibus/chef-14.10.9/omnibus/pkg/chef_14.10.9*arm*.deb

Chef 14.10.9 Packages