AWS Global Infrastructure


Topics Covered
  • DevOps (79 Blogs)
  • Mastering Git and GitHub (2 Blogs)
  • Docker (9 Blogs)
  • DevOps Engineer Masters Program (18 Blogs)

Install Chef – 6 Simple Steps for Installing Chef On CentOS

Last updated on Dec 15,2021 27.5K Views

Saurabh is a technology enthusiast working as a Research Analyst at Edureka.... Saurabh is a technology enthusiast working as a Research Analyst at Edureka. His areas of interest are - DevOps, Artificial Intelligence, Big Data and...
2 / 3 Blog from Chef

 Install Chef

Are you looking forward to become a Certified Professional in DevOps? Well, if the answer is yes, let me tell you that you need to master in all top tools of DevOps. One such tool out of the lot is Chef. So this blog is a guide on how to install Chef on a CentOS machine. Installing Chef is like a cake walk, you just have to execute a few commands.

Chef has three major components:

  1. Workstation
  2. Server
  3. Nodes

For demonstration purpose I will be using only one Node. There can be hundreds of Nodes managed by one Chef Server. I am using two CentOS Virtual Images one for Workstation and other for a Node. For Server, I will use the hosted version of Chef Server (on a cloud) available at manage. chef. myself

Following are the steps to install Chef:

  1. Install Chef DK (Development Kit) on Chef Workstation
  2. Setup a Chef Server
  3. Create a Recipe or a Cookbook / download a Cookbook from Chef Supermarket in Workstation
  4. Upload a Cookbook on the Chef Server
  5. Connect A Node To The Chef Server
  6. Deploy the Cookbook from the Server to the Node

1. Install Chef DK (Development Kit)

In my Chef Workstation I will install Chef DK. Chef DK is a package that contains all the development tools that you will need when coding Chef. Here is the link to download Chef DK.

Chef DK - Install Chef - Edureka

Here, choose the operating system that you are using. I am using CentOS 6.8. So, I will click on Red Hat Enterprise Linux.

CentOS Chef DK - Install Chef - Edureka

Copy the link according to the version of CentOS that you are using. I am using CentOS 6, as you can see that I have highlighted in the above screenshot.

Go to your Workstation terminal and download the Chef DK by using wget command and paste the link.

Execute this command:


Download Chef DK - Install Chef - Edureka

The package is now downloaded. Now I will install this package using rpm.

Execute this:

rpm -ivh chefdk-1.0.3-1.el6.x86_64.rpm

Install Chef DK - Install Chef - Edureka

2. Setup Chef Server

I will use the hosted version of Chef Server on the cloud but you can use a physical machine as well. This Chef-Server is present at

Chef Cloud Server - Install Chef - Edureka

Over here, create an account if you don’t have one. Once you have created an account, sign-in with your login credentials.

Chef Server - Install Chef - Edureka

This is how Chef Server looks like.

If you are signing in for the first time, the very first thing that you will be doing is creating an organization. Organization is basically a group of Machines that you will be managing with the Chef Server.

First, I will go to the administration tab. Over there, I have already created an organization called edu. So I need to download the starter kit in my Workstation. This starter kit will help you to push files from the Workstation to the Chef Server. Click on the settings icon on the right hand side and click on Starter Kit.

Chef Starter Kit - Install Chef - Edureka

Now you will get an option to download the Starter Kit. Just click on it to download the Starter Kit zip file.

Starter Kit Download - Install Chef - Edureka

Move this file to your root directory. Now unzip this file by using unzip command in your terminal. You will notice that it includes a directory called chef-repo.

Execute this:


Unzip Chef Starter kit - Install Chef - Edureka

Now move this starter kit to the cookbook directory in chef-repo directory.

Execute this:

mv starter /root/chef-repo/cookbooks

3. Download A Cookbook From Chef Supermarket In Workstation

Chef Cookbooks are available in the Cookbook Supermarket, we can go to the Chef Supermarket. Download the required Cookbooks from I’m downloading one of the Cookbook to install Apache from there.

Execute this:

cd chef-repo
knife cookbook site download learn_chef_httpd

Apache Package - Install Chef - Edureka

There is Tar ball downloaded for the Apache Cookbook. Now, I will extract the contents from this downloaded Tar file. For that, I will use tar command.

Execute this:

tar -xvf learn_chef_httpd-0.2.0.tar.gz

Untar Apache Package - Install Chef - Edureka

All the required files are automatically created under this Cookbook. There is no need to make any modifications. Let’s check the Recipe description inside my recipe folder.

Execute this:

cd /root/chef-repo/learn_chef_httpd/recipes
cat default.rb

Cookbook Contents - Install Chef - Edureka

Now, I will just upload this cookbook to my Chef Server as it looks perfect to me.

4. Upload A Cookbook In The Chef Server

In order to upload the Apache Cookbook that I have downloaded, first move this learn_chef_httpd file to the Cookbooks folder in the chef-repo. Then change your directory to cookbooks.

Execute this:

mv /root/chef-repo/learn_chef_httpd /root/chef-repo/cookbooks
cd /root/chef-repo/cookbooks

Now in this directory, execute the below command to upload the Apache Cookbook:

Execute this:

knife cookbook upload learn_chef_httpd

Upload Apache Cookbook - Install Chef - Edureka

Verify the Cookbook from the Chef Server Management console. In the policy section, you will find the Cookbook that you have uploaded. Refer the screenshot below:

Chef Server Policy Tab - Install Chef - Edureka

Now, our final step is to add Chef Node. We’ve setup a Workstation, a Chef Server and we need to add our Nodes to the Chef Server for automation.

5. Connect A Node To The Chef Server

The terminal color of my Node machine is different from the Workstation so that you will be able to differentiate between both.

I just need the IP address of my Node for that I will execute the below command in my Node machine.

Execute this:


Chef Node IP address - Install Chef - Edureka

I will add my Chef Node to the Server by executing Knife Bootstrap command in which I will specify the IP address of The Chef Node and its name. Execute the command shown below:

Execute this:

knife bootstrap --ssh-user root --ssh-password edureka --node-name chefNode



This command will also initialize the installation of the Chef-Client in the Chef Node. You can verify it from the CLI on the Workstation using the knife command,as shown below:

Execute this:

Knife node list

Chef Node List - Install Chef - Edureka

You can also verify from the Chef Server. Go to the nodes tab in your Server Management Console, here you will notice that the node that you have added is present. Refer the screenshot below:

Confirm Chef Node Addition - Install Chef - Edureka

6. Deploy The Cookbook From The Server To The Node

Let’s see how we can add a Cookbook to the Node and manage its Run list from the Chef Server. Run List describes the order in which the Cookbooks should be executed. As you can see in the screenshot below, click the Actions tab and select the Edit Run list option to manage the Run list.

Edit Run List - Install Chef - Edureka

In the Available Recipes,  you can see our learn_chef_httpd Recipe, you can drag that from the available packages to the current Run List and save the Run list.

Run List - Install Chef - Edureka

Current Run List - Install Chef - Edureka

Now login to your Node and just run chef-client to execute the Run List.

Execute this:


Execute Chef-Client - Install Chef - Edureka

Congratulations! you have successfully installed Chef and deployed Apache from your Chef Server to the Node.

I hope you were able to follow me through the installation process of Chef and by now Chef must be up and running in your machine.

If you found this blog on “Install Chef ” relevant, check out the DevOps training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. The Edureka DevOps Certification Training course helps learners gain expertise in various DevOps processes and tools such as Puppet, Chef, Jenkins, Nagios and GIT for automating multiple steps in SDLC.

Upcoming Batches For DevOps Certification Training Course
Course NameDateDetails
DevOps Certification Training Course

Class Starts on 17th June,2024

17th June

MON-FRI (Weekday Batch)
View Details
DevOps Certification Training Course

Class Starts on 22nd June,2024

22nd June

SAT&SUN (Weekend Batch)
View Details
DevOps Certification Training Course

Class Starts on 6th July,2024

6th July

SAT&SUN (Weekend Batch)
View Details
  • –ssh-user root –ssh-password edureka
    how to set user and password i am not understanding which user and password i should set ?
    ERROR: Net::SSH::ConnectionTimeout: Net::SSH::ConnectionTimeout
    can anyone help me how to solve ?

    • Greetings! You can add user as per your choice. You can change the password for any user using the command ” passwd
      Hope this helps :)

Join the discussion

Browse Categories

webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

Install Chef – 6 Simple Steps for Installing Chef On CentOS