chef client - sinherle/Recipes GitHub Wiki

Building Chef Client 12.9.38

The Chef Client 12.9.38 code can be built for a Linux on z System running RHEL 7.1/6.6, SLES 12/11 and UBUNTU 16.04 by following these instructions (Chef is available at https://www.chef.io/ and the github repository for the client can be found at https://github.com/chef/chef):

General Notes:
i) When following the steps below please use a standard permission user unless otherwise specified.
ii) A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Building Chef Client on RHEL 7.1/6.6, SLES 12/11

  1. Install the build dependencies

    For RHEL 7.1

    sudo yum install -y git gcc make wget tar bison flex openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel tcl-devel tk-devel sqlite-devel which
    

    For RHEL 6.6

    sudo yum -y install git gcc make wget tar bison flex openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel tcl-devel tk-devel sqlite-devel which	  
    

    For SLES 11

    sudo zypper install -y git gcc make wget tar bison flex libopenssl-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel tcl-devel tk-devel sqlite3-devel	      
    

    For SLES 12

    sudo zypper install -y git gcc make wget tar bison flex libopenssl-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel tcl-devel tk-devel sqlite3-devel
    

    For UBUNTU 16.04

    sudo apt-get install -y git make gcc make wget build-essential zlib1g zlib1g-dev libssl-dev libreadline-dev libgdbm-dev
    
  2. For SLES 11 you will need to build Openssl

    cd /<source_root>/
    wget ftp://openssl.org/source/openssl-1.0.2h.tar.gz
    tar zxf openssl-1.0.2h.tar.gz
    cd openssl-1.0.2h
    ./config --prefix=/usr --openssldir=/etc/ssl --libdir=lib shared zlib-dynamic
    make
    sudo make install
    
  3. Build Ruby 2.2.4

    3.1. Download the source code

    cd /<source_root>/
    wget http://cache.ruby-lang.org/pub/ruby/ruby-2.2.4.tar.gz
    tar zxf ruby-2.2.4.tar.gz
    cd ruby-2.2.4
    

For SLES 11

./configure LDFLAGS='-L/<source_root>/openssl-1.0.2h' --with-openssl-include=/<source_root>/openssl-1.0.2h/include --with-openssl-dir=/usr/

For RHEL 6.6, RHEL 7.1, SLES12 and UBUNTU 16.04

./configure

3.2. Build the source code

make
make test	  
sudo make install
  1. Move to the location you wish to store the Chef source in

    cd /<source_root>/
    
  2. Clone the github Chef client repository checkout the correct version

    git clone https://github.com/chef/chef.git
    cd chef
    git checkout v12.9.38
    
  3. Correct the gem environment for a standard user

    export GEM_HOME=/home/<USER>/.gem/ruby
    export PATH=/home/<USER>/.gem/ruby/bin:$PATH
    

    where <USER> is the standard user you are installing under.

    Note: Run gem env to verify the state of the environment, if later on you have issues installing / running ruby gems please ensure the environment is set correctly.

  4. Install the required version of the bundler ruby gem

    gem install bundler -v '1.11.2'
    
  5. Use bundler to install Chef Client's ruby gem dependencies

    bundle install
    
  6. Build the Chef Client ruby gem packages

    bundle exec rake gem
    

    NOTE: For RHEL7, if bundler: command not found: rake error occurs. Set rake binary path to PATH environment variable and rerun above command.

      export PATH=$PATH:$HOME/bin
    
  7. Install the gem you just built

ls pkg/*.gem | grep -v mingw32 | xargs gem install
  1. Chef client is now built and installed
chef-client -version

Testing Chef Client

If you'd like to test the Chef client you've just built and installed, just follow the steps below:

  1. Run the test suite

    cd /<source_root>/chef/
    bundle exec rake spec
    

    To run a single test file

    bundle exec rspec spec/PATH/TO/FILE_spec.rb
    

    To run a subset of tests

    bundle exec rspec spec/PATH/TO/DIR
    

    NOTE: This may fail as there can be a dependency on rdoc/task in the Rakefile, if that happens just comment out the rdoc/task line as below.

    require "chef-config/package_task"
    require 'rdoc/task'
    require_relative 'tasks/rspec'
    

    can be changed to be

    require "chef-config/package_task"
    #require 'rdoc/task'
    require_relative 'tasks/rspec'
    
  2. Visit https://github.com/chef/chef#testing for more

References:

https://github.com/chef/chef.git

⚠️ **GitHub.com Fallback** ⚠️