Skip to content

Instantly share code, notes, and snippets.

@fabioyamate
Forked from jnx/rbenv-install-system-wide.sh
Last active December 22, 2015 08:30
Show Gist options
  • Save fabioyamate/6445510 to your computer and use it in GitHub Desktop.
Save fabioyamate/6445510 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Run the script as root user
#
# copy the script to the /root and chmod +x to the file.
#
# $ ./rbenv-install-system-wide.sh
#
# and wait
# rm -r /usr/local/rbenv
# rm /etc/profile.d/rbenv.sh
# rm -r /tmp/ruby-build
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install git-core curl zlib1g-dev build-essential libssl-dev \
libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev \
libxslt-dev
# Install mysql
# apt-get -y install libmysqlclient-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:
cd /tmp
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh
cd ~
# Install Ruby:
rbenv install 2.0.0-p247
# Rehash:
rbenv rehash
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv:
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
# Add rbenv to the path:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bash_profile
echo 'eval "$(rbenv init -)"' >> .bash_profile
source ~/.bash_profile
# Install ruby-build:
pushd /tmp
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh
popd
# Install Ruby 1.9.2-p290:
rbenv install 1.9.2-p290
rbenv global 1.9.2-p290
# Rehash:
rbenv rehash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment