-
-
Save hardywu/51b1e2e7598b221979e0 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
PREFIX="/usr/local" | |
RBENV_PREFIX="$PREFIX/rbenv" | |
BIN_PATH="$PREFIX/bin" | |
RBENV_GROUP="rbenv" | |
umask 002 | |
## Install rbenv, ruby-build and rbenv-gem-rehash | |
git clone git://github.com/sstephenson/rbenv.git $RBENV_PREFIX | |
mkdir $RBENV_PREFIX/plugins | |
git clone git://github.com/sstephenson/ruby-build.git $RBENV_PREFIX/plugins/ruby-build | |
git clone git://github.com/sstephenson/rbenv-gem-rehash.git $RBENV_PREFIX/plugins/rbenv-gem-rehash | |
## add rbenv script to PATH | |
ln -s $RBENV_PREFIX/bin/rbenv $BIN_PATH/rbenv | |
## Add rbenv to the System wide profile: | |
## @note profiles only will be sourced in `login shell`, | |
## see the difference here(Chinese): https://gist.github.com/yegle/1564928 | |
cat <<EOF > /etc/profile.d/rbenv.sh | |
# rbenv setup | |
export RBENV_ROOT=${RBENV_PREFIX} | |
eval "\$(rbenv init -)" | |
EOF | |
chmod +x /etc/profile.d/rbenv.sh | |
source /etc/profile.d/rbenv.sh | |
## set rbenv group property | |
groupadd $RBENV_GROUP | |
chown -R :rbenv $RBENV_PREFIX | |
find $RBENV_PREFIX -type d -exec chmod g+Xs {} \; | |
## install ruby-build dependences | |
apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev | |
## Install Ruby | |
#rbenv install 1.9.3-p484 | |
#rbenv install 2.0.0-p353 | |
#rbenv global 2.0.0-p353 | |
rbenv install 2.1.1 | |
## Rehash: | |
rbenv rehash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment