rootで作業する場合
chef_envsetting
#!/bin/sh -x
#############################################################
# install package
PKG="gcc make zlib zlib-devel openssl openssl-devel git libffi-devel readline-devel wget bzip2"
# install ruby version
RB_VER="2.3.1"
# install gem version (https://rubygems.org/)
RB_GEM="2.6.6"
# install Chef Client Package (https://downloads.chef.io/chef-client/redhat/#/)
CHEF_PKG=chef-12.14.89-1.el7.x86_64.rpm
#############################################################
# package install
yum -y install ${PKG}
wget https://packages.chef.io/stable/el/7/${CHEF_PKG}
rpm -ivh ${CHEF_PKG}
# checkoud ruby
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
# rbenv setting
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ${HOME}/.bash_profile
echo $PATH
# checkout ruby-build
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
# ruby install
rbenv install ${RB_VER}
rbenv rehash
rbenv global ${RB_VER}
# download ruby-gems
git clone https://github.com/rubygems/rubygems
wget https://rubygems.org/rubygems/rubygems-${RB_GEM}.tgz
cd rubygems
ruby setup.rb
# install knife solo
gem install knife-solo --no-ri --no-rdoc
一般ユーザで作業する場合
前提はrpm類がインストールされていること
chef_envsetting
#!/bin/sh -x
#############################################################
# install ruby version
RB_VER="2.3.1"
# install gem version (https://rubygems.org/)
RB_GEM="2.6.6"
#############################################################
# checkoud ruby
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
# rbenv setting
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ${HOME}/.bash_profile
echo $PATH
# checkout ruby-build
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
# ruby install
rbenv install ${RB_VER}
rbenv rehash
rbenv global ${RB_VER}
# download ruby-gems
wget https://rubygems.org/rubygems/rubygems-${RB_GEM}.tgz
tar zxvf rubygems-${RB_GEM}.tgz
cd rubygems-${RB_GEM}
ruby setup.rb
# install knife solo
gem install knife-solo --no-ri --no-rdoc