Created
August 23, 2014 09:52
-
-
Save milmih/7beff4ad87cbef0a0e36 to your computer and use it in GitHub Desktop.
Setting rbenv up globally
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
#!/usr/bin/env bash | |
if [ "$UID" -ne 0 ] | |
then echo "Please run this script as root user" | |
exit | |
fi | |
apt-get -y update | |
apt-get -y upgrade | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev git sqlite3 libsqlite3-dev | |
git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
mkdir /usr/local/rbenv/plugins | |
git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins | |
cat <<EOF >> /etc/skel/.bashrc | |
#### begin rbenv configuration #### | |
## Remove these lines if you wish to use your own | |
## clone of rbenv (with your own rubies) | |
export RBENV_ROOT=/usr/local/rbenv | |
export PATH="$RBENV_ROOT/bin:$PATH" | |
eval "$(rbenv init -)" | |
# Allow local Gem management | |
export GEM_HOME="$HOME/.gem" | |
export GEM_PATH="$HOME/.gem" | |
export PATH="$HOME/.gem/bin:$PATH" | |
#### end rbenv configuration #### | |
EOF | |
cat <<EOF >> ~/.bashrc | |
#### begin rbenv configuration #### | |
## Remove these lines if you wish to use your own | |
## clone of rbenv (with your own rubies) | |
export RBENV_ROOT=/usr/local/rbenv | |
export PATH="$RBENV_ROOT/bin:$PATH" | |
eval "$(rbenv init -)" | |
#### end rbenv configuration #### | |
EOF | |
source ~/.bashrc | |
rbenv install 2.1.2 | |
rbenv rehash | |
rbenv global 2.1.2 | |
gem install rbenv-rehash --no-ri --no-rdocp |
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
echo "gem: --no-rdoc --no-ri" > ~/.gemrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If /usr/local/rbenv/plugins is empty, then the command:
leaves the contents of ruby-build/ directly in the plugins/ directory. It's safer to just use: