Berkshelf provides a better way of managing your Chef cookbooks than the classic opscode toolchain; e.g. using "knife cookbook site" to install community cookbooks.  Berkshelf requires a bit more setting up, but it is worth it.

Installing Berkshelf with Omnibus Chef

Berkshelf is a Ruby package, and needs to be installed using Ruby's package installation mechanisms; e.g. using "gem" or "bundle".  But there are a couple of catches:

  • You need to install into Berkshelf into the embedded Ruby that Omnibus Chef installs and uses.
  • To get the installation procedure to work, you also need to install distro packages for compiling some native libraries ... and the packages are distro dependent.
  • You then need to get the Berkshelf commands onto your shell's search path.

So here is the procedure ... assuming you have already installed Omnibus Chef.

  1. Install prerequisites for Berksfile:

    sudo yum install gcc gcc-c++ ruby-devel

    or

    sudo apt-get install build-essential ruby-dev
  2. Install Berkshelf into the embedded Ruby:

    sudo /opt/chef/embedded/bin/gem install berkshelf --no-ri --no-rdoc

    (The --no-ri --no-rdoc options say to not build and install Berkshelf's ruby documentation.)

  3. Either add "/opt/chef/embedded/bin" to your shell search path (i.e. the $PATH environment variable), or create symlinks to "/opt/chef/embedded/bin/berks" and other tools that you want to expose.
    (The former is quicker, but you probably should not expose the embedded "ruby", "gem" and other commands if you are intend to install and use normal Ruby packages.)