Skip to content

Instantly share code, notes, and snippets.

@tkhn
Forked from v1nc3ntlaw/rbenv-install-system-wide.sh
Last active January 2, 2016 20:09
Show Gist options
  • Select an option

  • Save tkhn/8355152 to your computer and use it in GitHub Desktop.

Select an option

Save tkhn/8355152 to your computer and use it in GitHub Desktop.
#
# Run as root
# $ bash <(curl -s https://gist.github.com/goldenbarb/8355152/raw/ec7c95aafbd41590a5e29f50e051564737c345ad/rbenv-install-system-wide.sh)
#
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl \
libssl-dev \
libyaml-dev \
libsqlite3-dev \
libreadline-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
echo '# rbenv setup' > /etc/profile.d/rbenv.sh
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
chmod +x /etc/profile.d/rbenv.sh
source /etc/profile.d/rbenv.sh
# Install ruby-build:
pushd /tmp
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh
popd
# list all available versions:
# $ rbenv install -l
# Install Ruby 2.1.0
rbenv install 2.1.0
rbenv global 2.1.0
# Rehash:
rbenv rehash
# Production install gems skipping ri and rdoc
echo "gem: --no-ri --no-rdoc" >> /root/.gemrc
gem update --system
gem install bundler
# Restart shell
exec $SHELL
# Install development tools:
sudo apt-get update
sudo apt-get -y install build-essential git-core \
make libc6-dev libssl-dev libssl-dev \
libreadline6-dev zlib1g-dev libyaml-dev
# Install rbenv:
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
# Add rbenv to the path:
echo 'if [ -d "$HOME/.rbenv" ] ; then' >> .bash_profile
echo ' export PATH="$HOME/.rbenv/bin:$PATH"' >> .bash_profile
echo ' eval "$(rbenv init -)"' >> .bash_profile
echo 'fi' >> .bash_profile
source ~/.bash_profile
# Install ruby-build:
mkdir ~/.rbenv/plugins
pushd ~/.rbenv/plugins
git clone git://github.com/sstephenson/ruby-build.git
popd
# Install Ruby 2.1.0:
rbenv install 2.1.0
rbenv global 2.1.0
# Rehash:
rbenv rehash
gem update --system
gem install bundler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment