Skip to end of metadata
Go to start of metadata



These directions provide two methods of installing Chef client on a node running CentOS, RHEL, and related Operating Systems.


Nodes are hosts whose configuration that you want to manage using Chef.

In general, installing chef-client on a node includes:

  • Installing Ruby and Other Dependencies
  • Installing Chef
  • Configuring Chef

Typically, chef-client is installed on CentOS systems using one of two possible methods:

  • Using Rubygems, or
  • Using a knife bootstrap script

You only need to use one of these three methods on any given node. Choose the method that makes the most sense for your environment.



Commands Run as Root

Commands that require root privileges are run with sudo in these directions. If your system is not configured to use sudo, run these commands as root using a method appropriate for your configuration.

BUG!

If you receive the following error during the installation process it is most likely the result of CHEF-2388, which is being actively investigated.

Install Ruby

Chef is written in Ruby and thus requires Ruby as well as other system dependencies to run. Ruby 1.8.7+ is required to run Chef. Run the following command to install ruby and other required dependencies:

On Red Hat and CentOS (Version 5)

Enable AegisCo repository to get Ruby 1.8.7.

If you will be installing a Chef Server on this host, you will also need to enable the RBEL repo:

Install Ruby and other development tools:

On Red Hat and CentOS (Version 6)

Install the RBEL repo

Install Ruby and other development tools:

On RHEL 6 you will need to add the "RHEL Server Optional" channel subscription for this command to succeed without missing dependencies.

Install RubyGems from Source

We prefer to install RubyGems from source rather than use the OS-provided version (if any), as it is cross platform, so we know what to expect.

Install RubyGems

Install Chef Gem

To install Chef and its dependencies, run the following code:

Install Chef

You will most likely want to disable selinux at this point. You can do this by editing the '/etc/sysconfig/selinux' file and editing it to be 'SELINUX=disabled'. You can also use the selinux::disabled recipe to do this when bootstrapping nodes.

If you are installing Chef to use chef-client, proceed below. If you are installing Chef-solo as a means of installing Chef Server, return to Installing Chef Server using Chef Solo. If you wish to use Chef-solo as your primary Chef client, see Chef Solo.

Configure chef-client

The initial configuration of a chef-client requires a client.rb configuration file and a validation.pem file to be placed in /etc/chef. At a minimum client.rb must contain the configuration settings necessary for chef-client to communicate with chef-server. validation.pem is the permission certificate for your validator client. This API client is used on the first-run of chef-client and is used to create a new API client for the node. To create these we do the following:

  1. Create /etc/chef:

  2. Create client.rb and validation.pem:

    If you have a properly configured workstation, you should be able to run the following command from your workstation's chef repository

    This will place client.rb and validation.pem in your current working directory on your chef workstation. You can then use scp or another method to move both files into /etc/chef on the node you are configuring.

    If you do not have a configured workstation, you should create a minimal /etc/chef/client.rb. If you are using your own chef-server client.rbshould look as follows (substituting the correct address of your chef server):

    client.rb

    If you are using Hosted Chef, client.rbshould look as follows (with ORGNAME replaced with your Organization Short Name}}:

    client.rb for Hosted Chef

    If you are using an open source Chef 10 or earlier server, client.rb should look as follows:

    client.rb for Chef 10



    Your validation.pem can be downloaded from your chef-server if you are running your own chef-server. On your Chef Server, validation.pem should be in /etc/chef/. Users of Hosted Chef can find their validator client's key from the Hosted Chef Management Console. Note that if you are using Hosted Chef, your key is named ORGNAME-validator.pem.

Chef client has a number of configuration settings that do not appear above. See Chef Configuration Settings for further details.

Bootstrap

It is often easiest to install Chef on a node using knife-bootstrap. Bootstrapping runs a script on the target system which install Ruby. This method requires the node to be accessible over SSH. In most cases, bootstrapping a new node will be as simple as running a single command. For instance, to bootstrap a CentOS 5.6 workstation you might run the following command:

You can also add -r 'recipe[selinux::disabled]' to the command to disable selinux when chef-client runs. See Knife Bootstrap and Launch Cloud Instances with Knife for complete documentation. The bootstrap scripts distributed with knife for CentOS use an install method similar to the Rubygems installation methods above.







Installing Chef Client and Chef Solo


Upgrade Instructions



Labels