How to Install Chef Workstation on Ubuntu Linux

This brief tutorials shows students and new users how to install Chef Workstation on Ubuntu 20.04 | 18.04.

Chef is a popular configuration management tool that allows IT admins to automate the deployment, management, and secure maintenance of IT resources across in an environment.

Chef has basically three components: Chef Workstation or Desktop, Chef Server and Chef Client/Node.

Because this post is about installing Check Workstation or Desktop, we’ll be discussing that only.

Chef workstation is the computer or system where the system admin creates recipes, cookbooks and other development work.

Check workstation is where admin and developers build and test processes. It is cross-platform which means it can be installed on Linux, Mac OS and Windows.

It also contains all the necessary packages and tools like Chef-CLI, Knife, Chef Infra Client and others.

To get started with install Chef Workstation in Ubuntu, follow the steps below.

There are multiple ways to install Chef on Ubuntu. One can install Chef Workstation via its APT Repository and using a script.

Installing Chef via APT Repository

One way to install Chef Workstation is via its APT Repository. Chef packages come in two flavors:

  • Stable: A build from this channel is an “official” release that has passed full user acceptance testing. 
  • Current: A build from this channel is an “integration” build that has passed full testing, but has not been officially released.

To install from either branch above, run the commands below to enable Apt to fetch packages over HTTPS.

sudo apt update
sudo apt-get install apt-transport-https

Next, run the commands below to install the public key for Chef software.

wget -qO - https://packages.chef.io/chef.asc | sudo apt-key add -

After that, run the commands below to add Chef repository.

echo "deb https://packages.chef.io/repos/apt/<CHANNEL> <DISTRIBUTION> main" > chef-<CHANNEL>.list

Replace <CHANNEL> with the release channel: stable or current.

Replace < DISTRIBUTION> with the appropriate distribution name:

  • For Ubuntu 16.04: xenial
  • For Ubuntu 18.04: bionic
  • For Ubuntu 20.04: focal

For example, if you’re installing from the stable channel on Ubuntu 20.04 the commands would be like this:

echo "deb https://packages.chef.io/repos/apt/stable focal main" > chef-stable.list

After adding the repository file, run the commands below to update the package repository list.

sudo mv chef-stable.list /etc/apt/sources.list.d/

Finally, run the commands below to update and install Chef Workstation.

sudo apt update
sudo apt install chef-workstation

That’s how to install Chef Workstation via its APT Repository.

Install from Script

If you want to quickly and easily install Chef from its scripts, use this method.

Either method should work. However, the script is the fastest.

To install via Chef script, simply run the commands below:

curl -L https://omnitruck.chef.io/install.sh | sudo bash

Enter your password when prompted. This script will download and install all dependencies, prepare your machine and install Chef packages.

To verify the version of Chef installed, simply run the commands below:

chef -v

That should display similar lines as below:

Chef Workstation version: 21.2.303
Chef Infra Client version: 16.10.17
Chef InSpec version: 4.26.13
Chef CLI version: 3.1.1
Chef Habitat version: 1.6.181
Test Kitchen version: 2.10.0
Cookstyle version: 7.8.3

That’s it!

Conclusion:

This post showed you how to install Chef Workstation on Ubuntu 20.04 | 18.04. If you find any error above, please use the form below to report.

You may also like the post below:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.