Skip to content

Instantly share code, notes, and snippets.

@nathenharvey
Last active December 10, 2015 00:39
Show Gist options
  • Save nathenharvey/4353104 to your computer and use it in GitHub Desktop.
Save nathenharvey/4353104 to your computer and use it in GitHub Desktop.

In the Chef Office Hours on December 20, 2012

Rob asked about getting chef installed on his server. We manually installed Chef there following the instructions at http://www.opscode.com/chef/install/ and then ran a knife bootstrap command. The easier way would have been to simply run the knife bootstrap command.

For example after launching a fresh instance on EC2, I can simply run:

$ knife bootstrap ec2-184-73-68-244.compute-1.amazonaws.com -x ubuntu -i ~/.aws/nharvey-aws.pem --sudo

-x is the username I'll login with: ubuntu
-i is the identify file I'll use when logging in: ~/.aws/nharvey-aws.pem
--sudo tells the system to use sudo when bootstrapping the server.

After the bootstrap has completed, I can verify that chef is properly installed by logging into the server:

$ ssh [email protected] -i ~/.aws/nharvey-aws.pem

ubuntu@ip-10-122-241-110:~$ export PATH=/opt/chef/bin/:/opt/chef/embedded/bin/:$PATH
ubuntu@ip-10-122-241-110:~$ ruby -v
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
ubuntu@ip-10-122-241-110:~$ chef-client --version
Chef: 10.16.2

The knife bootstrap command is fully documented at http://docs.opscode.com/knife_bootstrap.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment