How to Install and Configure Chef on Ubuntu 17.04

Chef is a free and open source configuration management tool. It is written in Ruby and Erlang. Chef can easily integrate with cloud platforms like AWS, OpenStack or Rackspace, etc. to automatically create and manage servers. As an organization grows and the number of sites increases, it becomes difficult for the system administrator to manage each site on his own. This is where Chef comes to the rescue. The Chef system consists of three parts, the Chef server, workstations and Chef nodes. The DevOps tool allows the system administrator to manage multiple sites from a central location.

In this article, we will install the latest Chef on Ubuntu 17.04 (Zesty Zapus).

Prerequisites for installation:

  • Minimum Ubuntu Server 17.04.
  • Main privileges. This tutorial is written for the root user, if you are logged in as SUDO user, run sudo -i.
  • Domain name specified on your server.

Basic system update

It is recommended to update packages and repositories with the following command before installing a package

apt update && apt -y upgrade

After your system is updated, you can move on.

Hostname update

Chef requires a hostname set on the server. The hostname must be FQDN or Full Qualified Domain Name, for example, To set the hostname on the server, run the following command.

hostname ''

Replace with your domain name. Also, update the hostname in the / etc / hostname.

echo "" | tee /etc/hostname

Add the IP address of your host in the / etc / hosts file by running the following command.

echo "" >> /etc/hosts

Replace with your actual public IP address.

Configuring NTP

An NTP Network Time Protocol server is required to synchronize the server clock. Chef requires the system to which it is connected to run NTP, as it is very sensitive to time changes. NTP runs on port 123 on UDP. To install NTP on the server, run the following command.

apt install ntp

Start NTP by running the following command.

systemctl start ntp

To enable NTP to start automatically at boot time, run the following command.

systemctl enable ntp

You can verify that NTP has a synchronized clock by running the following command.

ntpq -p

You should see the following output:

[email protected]:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
 0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 2.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 3.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000  .POOL.          16 p    -   64    0    0.000    0.000   0.000    2 u    2   64    1   28.924   -0.036   0.065 (n2.    2 u    1   64    1   51.909    2.922   0.037
*ground.corbina.     2 u    2   64    1    2.826    0.274   0.031

Downloading and installing Chef

Download the Chef Server package for Ubuntu by running the following command.


You can always find a link to the latest version of Chef by visiting the download page Chef… Now install the package by running the following command.

dpkg -i chef-server-*.deb

Chef is now installed on your system. You will need to configure the server before using it.

Chef setup

Now you can run the following command to start all the services Chef needs to run.

chef-server-ctl reconfigure

The above command will take a few minutes as it installs and configures all the Chef server components. After successful completion, you should receive the following message at the end.

Chef Client finished, 491/1096 resources updated in 03 minutes 13 seconds
Chef Server Reconfigured!

You can check that the services have started successfully by running the following command:

chef-server-ctl status

You should see the following output.

[email protected]:~# chef-server-ctl status
run: bookshelf: (pid 6030) 87s; run: log: (pid 6047) 86s
run: nginx: (pid 5859) 91s; run: log: (pid 6387) 82s
run: oc_bifrost: (pid 5766) 92s; run: log: (pid 5842) 92s
run: oc_id: (pid 5849) 91s; run: log: (pid 5854) 91s
run: opscode-erchef: (pid 6244) 84s; run: log: (pid 6108) 85s
run: opscode-expander: (pid 5926) 88s; run: log: (pid 6010) 87s
run: opscode-solr4: (pid 5895) 89s; run: log: (pid 5912) 89s
run: postgresql: (pid 5718) 93s; run: log: (pid 5745) 92s
run: rabbitmq: (pid 5239) 101s; run: log: (pid 5099) 105s
run: redis_lb: (pid 5036) 121s; run: log: (pid 6361) 83s

Installing the Web Management Console

Chef provides a web-based graphical user interface for the Chef server administrator. You can use a GUI-based console to manage datasets, attributes, launch sheets, roles, environment, and cookbooks.

To install Chef control, run the following command:

chef-server-ctl install chef-manage

Reconfiguring the Chef server by typing again:

chef-server-ctl reconfigure

Finally, configure Chef control with the following command.

chef-manage-ctl reconfigure

This command will ask you to accept the terms of the license agreement. You can choose to accept the license agreement at startup time or simply run the following command to automatically accept the license.

chef-manage-ctl reconfigure --accept-license

Create administrator and organization

Before you can log in and use the admin console, you will need to create a user and organization. When you create a user and an organization, it automatically generates the RSA private keys required to connect to the workstations and the client. You can create a new .chef directory to store keys. Run the command to create a new folder for storing private keys.

mkdir ~/.chef

Now create a new administrator by running the following command.

chef-server-ctl user-create admin Chef Administrator [email protected] StrongPassword -f ~/.chef/admin.pem

Replace admin with the chosen name, Chef with the first and last name of the admin, your email [email protected] and admin.pem should match your username. Replace StrongPassword with a very strong password.

Now create a new organization by running the following command:

chef-server-ctl org-create my_org 'My Organization' --association_user admin -f ~/.chef/my_org.pem

Replace my_org with the short name of your organization, My Organization with the full name of your organization, and admin with the administrator rights you created.

Access to the web console

Now installed and configured so that everything you need to access the web console, you can access the console by navigating to the following URL through your favorite browser.


You can also use a domain name instead of the server IP if you have a domain configured. You should see the following login screen.

Log in using the username and password you created. After you have successfully logged in, you will see the following interface.

Chef Panel

Installing additional plugins

You can enable reports to see the process on all Chef clients that are managed by the Chef server. You can run reports using the Chef Management Console to view reports on the web console. Reports can be generated for the entire organization, and they can be generated for specific sites. To install reports, run the following command.

chef-server-ctl install opscode-reporting

Reconfigure the Chef server by running:

chef-server-ctl reconfigure

Configuring the reporting module using the command:

opscode-reporting-ctl reconfigure

You can check if the installad plugin is installed and working correctly by running:

opscode-reporting-ctl test

Likewise, you can install Chef Push jobs to do jobs. Chef Push jobs allows the Chef server to execute jobs with nodes independently of the Chef clients. Chef Push jobs uses the Chef API server and Ruby client to initiate all connections to the Chef server. Install Push Jobs by running the following command:

chef-server-ctl install opscode-push-jobs-server

Reconfigure the Chef server by running:

chef-server-ctl reconfigure

Configuring the launch of the Push Jobs module:

opscode-push-jobs-server-ctl reconfigure


In this article, we learned how to install the latest Chef on the latest Ubuntu. You can find out more about Chef by visiting Chef website