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.