Last active
December 17, 2015 21:49
-
-
Save mengqing/5677522 to your computer and use it in GitHub Desktop.
Bash script to bootstrap chef solo using RVM on an Ubuntu server
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
DEFAULT_RUBY_VERSION="2.0.0-p195" | |
sudo apt-get -y install curl git-core bzip2 build-essential zlib1g-dev libssl-dev autoconf | |
if [ -x /usr/local/rvm/bin/rvm ]; then | |
echo "RVM Found..nothing to do"; | |
else | |
echo "Installing RVM"; | |
curl -L https://get.rvm.io | bash -s -- --autolibs=read-fail; | |
fi | |
. /etc/profile | |
has_ruby_version=`rvm list | grep -c $DEFAULT_RUBY_VERSION` | |
if [ $has_ruby_version -eq "0" ]; then | |
rvm install $DEFAULT_RUBY_VERSION | |
# rvm system ; rvm gemset export system.gems ; rvm $DEFAULT_RUBY_VERSION; rvm gemset import system.gems | |
rvm alias create default $DEFAULT_RUBY_VERSION | |
else | |
echo "RVM has already installed Ruby v$DEFAULT_RUBY_VERSION" | |
fi | |
gem install chef --no-ri --no-rdoc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment