How Do You Get Chef to Be Automatically Installed and Configured (e.g., in a Docker Container)?

Problem scenario
You have a Docker container that supports Chef or some automatic way of installing Chef. The automation is failing at the end because you are being prompted to accept a license. What should you do to be able to invoke Chef commands automatically?

With the first Chef command, e.g., “chef env”, use the “–chef-license accept” option/flag. Here is an example:

chef env –chef-license accept

For more information,

How Do You Install “inspec” with gem from the Command Line?

Problem scenario
You want to install the inspec gem. What do you do?

Run this:
gem install inspec
(Taken from )

Does the inspec-bin command work? This may be a newer version that is already installed.

If you installed Ruby with root, which is not recommended according to,

How Do You Install and Configure Chef Client on a Linux Server in AWS or Azure?

Updated 11/9/17

Problem scenario
In AWS or Azure you have Linux instances that you want to be configured to use a Chef Server.  How do you install Chef client and configure it to work with a Chef server?

These directions have been tested in Azure (with an Ubuntu 16.x server as either the Chef client node or the Chef server) and AWS (with a Red Hat Enterprise Linux 7.x server as the Chef client node or the Chef server).

A List of Chef Books

A Practical Guide to Continuous Delivery by Eberhard Wolff         
Automation through Chef Opscode: A Hands-on Approach to Chef by Navin Sabharwal and Manak Wadhwa
Chef Essentials by John Ewart
Chef Cookbook – Third Edition by Matthias Marschall      
Chef Infrastructure Automation Cookbook – Second Edition by Matthias Marschall
Chef Server on AWS (AWS Quick Start) by AWS Whitepapers and Amazon Web Services
Configuration Management with Chef-Solo by Naveed ur Rahman
Customizing Chef: Getting the Most Out of Your Infrastructure Automation by Jon Cowie
Exploration of Chef: Fast And Easy Learning!

How Do You Troubleshoot the Chef Error “Field ‘name” invalid” after Running a chef-server-ctl Command?

Problem scenario
You are trying to create an organization using the chef-server-ctl org-create command.  But you get an error that the “name” entered was invalid.  For example, you run this:

sudo chef-server-ctl org-create ContInt “ContinualIntegration” –association_user contintuser –filename /bin/good.pem

But you get this:

ERROR: The data in your request was invalid
Response: Field ‘name’ invalid

What should you do?

For the “shortname” that is immediately after the “org-create” command,

How Do You Write a Chef Recipe to Deploy a Apache Web Server to Linux Servers?

Problem scenario
You have Linux servers that need Apache web server installed on them.  How do you write a Chef recipe to deploy Apache web server?


This solution requires that the Chef server must have access to GitHub.  If you want to install Chef server, see this posting.  If you want to install Chef client, see this posting

How Do You Fix “404 not found” Errors When You Run Knife Commands?

Problem scenario
You try to run a knife command but you get 404 not found.  What should you do?

Run this command: knife client list

If you get a 404 error with this command, then look at your client.rb file.  Is the chef_server_url correct?  Is the hostname actually the Chef server or is it something else?  Is the “organizations/companynickname” present and correctly typed?