To set up a local machine or cloud server that will act as a "management workstation" for developing Chef cookbooks and recipes and pushing them to a source control management system (e.g. GitHub).
There are two different ways to set up a Chef development machine. You can either install Chef locally or launch a server in the cloud. If you plan to actively develop Chef cookbooks and recipes you may want to set up your local machine for that purpose. However, for learning and training purposes you might find it eaiser and more useful to launch and configure a cloud server instead.
One of the benefits of the cloud is that you can easily launch and configure a cloud server instance for developing Chef cookbooks. For your convenience, RightScale has a ServerTemplate in the MultiCloud Marketplace that you can use to launch a cloud server where the Chef development environment will automatically get installed and configured at boot time.
See the Intermediate Chef Tutorial for details.
If you feel more comfortable using your own computer for developing and testing Chef cookbooks, you will need to install Chef, git, and a few other tools to set up your development environment. See Opscode's System Requirements to see which platforms currently support Chef.
Follow the instructions below to install Chef and complete the configuration process based on your OS distribution.
The first step is to install the Chef Ruby Gem, which will add all of the required libraries and binaries for Chef. Since you'll be developing Chef cookbooks and recipes that will be executed using the RightScale platform, you do not have to install Chef Server, Chef Solo, or a Chef Client because the RightScale platform and/or the RightLink agent (installed on the instance) will provide that functionality instead.
As long as Ruby is installed on the machine, you can run the following command, which should work on Mac OS and most Linux and Debian machines.
It's important that you run the command as root or with sudo, otherwise Chef will get installed at ~/.gem and will not be in your $PATH, which will make it inaccessible to other users on your machine.
sudo gem install chef
See the Fast Start Guide for Windows page (by Opscode) for detailed instructions on how to install Chef on a Windows machine.
When you install Chef, a binary called knife will become available for use. Before you can use the knife utility to create cookbooks and recipes, you must first configure it. You will use knife to interact with your Chef cookbooks and recipes on your local machine. Since you are using Chef with RightScale, you do not have to specify valid values for connecting to a Chef server because the RightScale platform performs that role for your cookbooks and recipes instead.
Use the sample code below to create a simple configuration file for knife. Simply run knife configure and accept all of the defaults.
Note: You can safely ignore the warning messages about missing Chef server information because it does not apply (as long as you're using the Chef cookbooks and recipes in the context of the RightScale platform).
knife configure No knife configuration file found Where should I put the config file? [~/.chef/knife.rb] Please enter the chef server URL: [http://localhost:4000] Please enter an existing username or clientname for the API: [your-username] Please enter the validation clientname: [chef-validator] Please enter the location of the validation key: [/etc/chef/validation.pem] Please enter the path to a chef repository (or leave blank): WARN: ***** WARN: WARN: You must place your client key in: WARN: /Users/rgeyer/.chef/rgeyer.pem WARN: Before running commands with Knife! WARN: WARN: ***** WARN: WARN: You must place your validation key in: WARN: /etc/chef/validation.pem WARN: Before generating instance data with Knife! WARN: WARN: ***** WARN: Configuration file written to /Users/rgeyer/.chef/knife.rb
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.