Created
April 5, 2012 03:16
-
-
Save jordandm/2307692 to your computer and use it in GitHub Desktop.
Chef Amazon Linux Boostrap File for Ruby 1.9.3 on AmazonLinux 2012.03
This file contains 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
bash -c ' | |
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%> | |
if [ ! -f /usr/bin/chef-client ]; then | |
yum groupinstall -y 'Development tools' | |
yum install -y libxml2-devel libxslt-devel | |
yum install -y ruby19 ruby19-devel rubygems19 rubygem19-rdoc rubygem19-rake rubygem19-bigdecimal | |
ln -sf /usr/bin/ruby1.9 /usr/bin/ruby | |
ln -sf /usr/bin/gem1.9 /usr/bin/gem | |
ln -sf /usr/bin/irb1.9 /usr/bin/irb | |
ln -sf /usr/bin/rdoc1.9 /usr/bin/rdoc | |
ln -sf /usr/bin/rake1.9 /usr/bin/rake | |
fi | |
gem1.9 update --system | |
gem1.9 install bigdecimal | |
gem1.9 install rdoc | |
gem1.9 install rake | |
gem1.9 install yaml --no-rdoc --no-ri --verbose | |
gem1.9 install ohai --no-rdoc --no-ri -v 0.6.10 --verbose | |
gem1.9 install chef --no-rdoc --no-ri -v 0.10.8 --verbose | |
gem1.9 install multi_json -v '1.0.3' --no-rdoc --no-ri --verbose | |
gem1.9 install aws-sdk --no-rdoc --no-ri --verbose | |
gem1.9 install fog --no-rdoc --no-ri --verbose | |
mkdir -p /etc/chef | |
( | |
cat <<'EOP' | |
<%= validation_key %> | |
EOP | |
) > /tmp/validation.pem | |
awk NF /tmp/validation.pem > /etc/chef/validation.pem | |
rm /tmp/validation.pem | |
( | |
cat <<'EOP' | |
<%= config_content %> | |
EOP | |
) > /etc/chef/client.rb | |
( | |
cat <<'EOP' | |
<%= { "run_list" => @run_list }.to_json %> | |
EOP | |
) > /etc/chef/first-boot.json | |
<%= start_chef %>' |
This file contains 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
#!/usr/bin/env bash | |
# Perform an in place upgrade of Ruby from 1.8.7 to 1.9.3 on Amazon Linux 2012.03. | |
# Based on | |
# http://tickets.opscode.com/browse/CHEF-3011 | |
# https://forums.aws.amazon.com/thread.jspa?messageID=333661 | |
# Update the system | |
sudo yum clean all | |
sudo yum update -y | |
# Update our development tools and ruby install | |
sudo yum groupinstall -y 'Development tools' | |
sudo yum install -y libxml2-devel libxslt-devel | |
sudo yum install -y ruby19 ruby19-devel rubygems19 rubygem19-rdoc rubygem19-rake rubygem19-bigdecimal | |
# Link R19 in place of R18: | |
sudo ln -sf /usr/bin/ruby1.9 /usr/bin/ruby | |
sudo ln -sf /usr/bin/gem1.9 /usr/bin/gem | |
sudo ln -sf /usr/bin/irb1.9 /usr/bin/irb | |
sudo ln -sf /usr/bin/rdoc1.9 /usr/bin/rdoc | |
sudo ln -sf /usr/bin/rake1.9 /usr/bin/rake | |
# Update our gems. We are being a little paranoid and using gem1.9 directly. | |
sudo gem1.9 update --system | |
sudo gem1.9 install bigdecimal | |
sudo gem1.9 install rdoc | |
sudo gem1.9 install rake | |
sudo gem1.9 install yaml --no-rdoc --no-ri --verbose | |
sudo gem1.9 install ohai --no-rdoc --no-ri -v 0.6.10 --verbose | |
sudo gem1.9 install chef --no-rdoc --no-ri -v 0.10.8 --verbose | |
sudo gem1.9 install multi_json -v '1.0.3' --no-rdoc --no-ri --verbose | |
sudo gem1.9 install aws-sdk --no-rdoc --no-ri --verbose | |
sudo gem1.9 install fog --no-rdoc --no-ri --verbose | |
# Converge the node | |
sudo chef-client | |
sudo service chef-client stop | |
sudo service chef-client start |
Good suggestions. I also went paranoid and used gem1.9 vs. just calling gem. Do note that the yum group 'Development tools' does not include the libraries and that the 'Development Libraries' group does not include libxslt-devel.
One downside of the group install is that it is bringing in things that are not exactly necessary (like rpm package checking).
Ok, that was stupid of me. Didn't need to 'sudo' in the bootstrap file....
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You might want yum groupinstall 'Development Tools' instead of yum install automake autoconf make libxslt-devel ...