Skip to content

Instantly share code, notes, and snippets.

@andregoncalves
Last active December 22, 2015 14:09
Show Gist options
  • Select an option

  • Save andregoncalves/6484262 to your computer and use it in GitHub Desktop.

Select an option

Save andregoncalves/6484262 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
sudo rm -rf ~/chef
mkdir ~/chef
cd ~/chef
chef_binary=/usr/local/bin/chef-solo
# Are we on a vanilla system?
if ! test -f "$chef_binary"; then
export DEBIAN_FRONTEND=noninteractive
# Upgrade headlessly (this is only safe-ish on vanilla systems)
aptitude update
apt-get -o Dpkg::Options::="--force-confnew" \
--force-yes -fuy dist-upgrade &&
# Install Ruby and Chef
cd ~
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev curl git-core
wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz
tar -xvzf ruby-2.0.0-p353.tar.gz
cd ruby-2.0.0-p353
./configure
make
sudo make install
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc
sudo gem install bundler --no-rdoc --no-ri
sudo gem install chef --no-rdoc --no-ri
sudo mkdir /usr/local/chef
sudo groupadd deploy
sudo usermod -a -G deploy andregoncalves
sudo chgrp -R deploy /usr/local/chef
sudo chmod -R g+rwxs /usr/local/chef
fi
echo "--finished bootstrapping--"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment