How to Install Chef Workstation on Ubuntu Linux

|

|

The article provides a tutorial on how to install Chef Workstation on Ubuntu 20.04 or 18.04. Chef Workstation, part of the Chef configuration management tool, is where system admins create recipes, cookbooks, and development work. The tutorial gives two methods to install Chef Workstation – via the APT Repository and using a script, detailing the…

This brief tutorial shows students and new users how to install the 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 an environment.

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

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

The 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, and Chef Infra Client.

To start installing 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 use a script.

Installing Chef via APT Repository

One way to install the 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 the 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 the 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 the Chef Workstation on Ubuntu 20.04 | 18.04. If you find any error above, please use the form below to report.


Discover more from Geek Rewind

Subscribe to get the latest posts to your email.

Like this:



One response to “How to Install Chef Workstation on Ubuntu Linux”

  1. ashok Avatar
    ashok

    WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

    You are installing a package without a version pin. If you are installing
    on production servers via an automated process this is DANGEROUS and you will
    be upgraded without warning on new releases, even to new major releases.
    Letting the version float is only appropriate in desktop, test, development or
    CI/CD environments.

    WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

    Installing chef
    installing with dpkg…
    (Reading database … 208893 files and directories currently installed.)
    Preparing to unpack …/chef_17.9.26-1_arm64.deb …
    removing /opt/chef…
    Unpacking chef (17.9.26-1) over (17.9.26-1) …
    Setting up chef (17.9.26-1) …
    Thank you for installing Chef Infra Client!
    sh: 0: getcwd() failed: No such file or directory

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.

Blog at WordPress.com.