Created
September 27, 2016 06:40
-
-
Save kacchan822/b9447002252d90a79d7306b73dd573f1 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
# | |
# instal rbenv and then, install ruby 2.3.0 and gem update, install bundler. | |
# This script is written for CentOS 7. | |
# | |
set -e | |
if [ ! -e /etc/redhat-release ]; then | |
echo "This script can only run on CentOS!" | |
exit 1 | |
fi | |
export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin" | |
echo "Starting install rbenv -------------------------------------------------------" | |
echo "install git" | |
yum install -y git | |
echo "clone rbenv and ruby-buld from github ----------------------------------------" | |
git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
git clone https://github.com/sstephenson/ruby-build.git \ | |
/usr/local/rbenv/plugins/ruby-build | |
echo "Install dependency packeges --------------------------------------------------" | |
yum install -y gcc gcc-c++ bzip2 openssl-devel libyaml-devel libffi-devel \ | |
readline-devel zlib-devel gdbm-devel ncurses-devel sqlite-devel tar | |
echo "Set Env ----------------------------------------------------------------------" | |
echo 'export RBENV_ROOT="/usr/local/rbenv"' >>/etc/profile.d/rbenv.sh | |
echo 'export PATH="${RBENV_ROOT}/bin:${PATH}"' >>/etc/profile.d/rbenv.sh | |
echo 'eval "$(rbenv init -)"' >>/etc/profile.d/rbenv.sh | |
source /etc/profile.d/rbenv.sh | |
echo "Install ruby and set global --------------------------------------------------" | |
rbenv -v | |
rbenv install 2.3.0 | |
rbenv global 2.3.0 | |
echo "Update gem -------------------------------------------------------------------" | |
gem update --system | |
gem -v | |
echo "Install bundler system -------------------------------------------------------" | |
gem install bundler | |
bundler -v | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment