Skip to content

Instantly share code, notes, and snippets.

@cmaitchison
Last active October 12, 2015 20:29
Show Gist options
  • Save cmaitchison/4083459 to your computer and use it in GitHub Desktop.
Save cmaitchison/4083459 to your computer and use it in GitHub Desktop.
Ubuntu 12.04 Chef-client baseline (AWS)
#!/bin/bash -xe
#THIS SCRIPT MUST BE RUN AS ROOT
#configure locale
echo "export LANGUAGE=en_AU.UTF-8" > /tmp/locale
echo "export LANG=en_AU.UTF-8" >> /tmp/locale
echo "export LC_ALL=en_AU.UTF-8" >> /tmp/locale
cat /etc/bash.bashrc >> /tmp/locale
cp /tmp/locale /etc/bash.bashrc
locale-gen en_AU.UTF-8
dpkg-reconfigure locales
#update packages
apt-get update
apt-get upgrade -y
#synchronise time
ntpdate ntp.ubuntu.com
#install ruby
RUBY_PATCH=p0
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-$RUBY_PATCH.tar.gz
tar -xvzf ruby-2.0.0-$RUBY_PATCH.tar.gz
cd ruby-2.0.0-$RUBY_PATCH/
./configure --prefix=/usr/local
make
make install
apt-get install git-core -y
echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
echo "gem: --no-ri --no-rdoc" >> /etc/skel/.gemrc
echo "gem: --no-ri --no-rdoc" >> /root/.gemrc
echo "gem: --no-ri --no-rdoc" >> /home/ubuntu/.gemrc
echo "gem: --no-ri --no-rdoc" >> /etc/gemrc
#install chef
gem install chef ruby-shadow
mkdir -p /var/chef
chown ubuntu:ubuntu /var/chef/
mkdir /u
chown ubuntu:ubuntu /u
gem install bundler
gem install libv8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment