Skip to content

Instantly share code, notes, and snippets.

@kozy4324
Last active December 18, 2015 09:39
Show Gist options
  • Save kozy4324/5763135 to your computer and use it in GitHub Desktop.
Save kozy4324/5763135 to your computer and use it in GitHub Desktop.
CentOS6.3でsystem Rubyを1.8.7→1.9.3、Chefを10系→最新に置き換えるVagrantのprovision shell
if [ -n "$(ruby --version|grep 'ruby 1.8')" ]; then
# yum settings
rpm --import http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
# install dependencies to compile ruby
yum install -y zlib-devel openssl-devel readline-devel ncurses-devel gdbm-devel db4-devel libffi-devel tk-devel libyaml-devel
# uninstall system ruby 1.8.x
yum -y erase rubygems.noarch
yum -y erase ruby.x86_64
# install ruby 1.9.3
wget -O ruby-1.9.3-p429.tar.gz http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p429.tar.gz
tar -zxf ruby-1.9.3-p429.tar.gz
chown -R vagrant:vagrant ruby-1.9.3-p429
cd ruby-1.9.3-p429
./configure --prefix=/usr --disable-install-doc
make && make install
# install chef-solo & bundler
gem install chef --no-rdoc --no-ri
gem install bundler --no-rdoc --no-ri
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment