Created
October 18, 2012 04:05
-
-
Save ForestMars/3909803 to your computer and use it in GitHub Desktop.
Chef install script - installs client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Run this script (with sudo) to install Chef & Chef Server on a Debian based system. | |
| #!/bin/sh | |
| ## script to install Ruby prerequisites on Ubuntu so that Chef can be used to manage configuration. | |
| ## authored by Forest Mars for Elephant Ventures | |
| ## please run this script as a user with sudo | |
| # First we'll add opscode as a trusted repository (and update again) | |
| echo "deb http://apt.opscode.com/ precise-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list | |
| mkdir -p /etc/apt/trusted.gpg.d | |
| gpg --keyserver keys.gnupg.net --recv-keys 83EF826A | |
| gpg --export packages@opscode.com | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null | |
| aptitude update | |
| aptitude install opscode-keyring | |
| # Update sources, baseline and install prerequisites | |
| aptitude -y upgrade | |
| aptitude install -y build-essential wget zlib1g-dev libssl-dev libffi-dev libncurses-dev libreadline-dev libyaml-dev libffi6 libssl0.9.8 | |
| # Precise Pangolin ships with Ruby 1.8.7 (not using rvm) | |
| aptitude install ruby | |
| # Gems are only included by default with Ruby >= 1.9 | |
| aptitude install rubygems | |
| # And now we install Chef | |
| aptitude install chef | |
| mkdir -p ~/.chef | |
| chown -R $USER ~/.chef | |
| # If you're running this on a Rackspace cloud server, uncomment this line or you won't have knife. | |
| apt-get install --reinstall chef | |
| ## This is a chef client only, so we'll have to grab the pem keys off the chef-server | |
| # cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef | |
| ## Finally, once you have your chef-server keys on the client, you can run knife configure: | |
| # knife configure -i | |
| ## ca. http://wiki.opscode.com/display/ChefCN/Manual+Chef+Server+Configuration |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On a Rackspace cloud server you have to reinstall Chef or knife will be missing-- I've confirmed/reproduced this a number of times for both their First-Generation cloud servers and both regions (Dallas & Chicago) of their Next-Generation cloud servers. This seems to result from the clean-up scripts that run after they provision the server with chef-solo.