Installing ChefDK(Chef Development Kit) isn’t too complicated, but there are a few things to watch out for. We’re going to run through a simple install here real quick, to help keep you from hitting the potholes that trip people up sometimes.
Before a ChefDK install, there’s got to be a download, and you can download ChefDK here. You can choose from several OS packages, and there are also some release options that allow you to grab older stable versions if you want. As of right now (July 2019) those older versions are on the upper right of the page.
Let’s pretend we’re running a CentOS 7 box, and we want an older stable version of ChefDK. And someone you’re working with requires version 2.4.17. We can navigate to https://downloads.chef.io/chefdk/stable/2.4.17 and download the Red Hat Enterprise Linux 7 rpm file. If you’re already sitting in your server, you can run:
This will grab it directly. Once you pull the file down, just install it with
rpm -ivh chefdk-2.4.17-1.el7.x86_64.rpm.
One More ChefDK Install Tweak
If you want to use the version of Ruby that came with this ChefDK install package, then you’re not quite done yet. You’ve got to hack your Bash profile a bit, so run this from your own home directory:
echo 'eval "$(chef shell-init bash)"' >> ~/.bash_profile
That will make it happen. You’ll either have to log out and in again for it to take effect, or run
source ~/.bash_profile to do it faster.
You’ve got ChefDK installed. Now how do you use it? I can’t answer that, but Kevin James can, over in his Chef Local Cookbook Development Badge course. It’s been in “preview” status for a little while but is now completely launched. There are hands-on labs to give you some practice actually using ChefDK. You’ll create cookbooks, make recipes, and even troubleshoot a situation where things are broken down.
Good luck, and tell Kevin I said “Hi.”