Skip to content

Instantly share code, notes, and snippets.

@jnx
Created October 1, 2011 20:09
Show Gist options
  • Save jnx/1256593 to your computer and use it in GitHub Desktop.
Save jnx/1256593 to your computer and use it in GitHub Desktop.
rbenv install and system wide install on Ubuntu 10.04 LTS.
# 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 /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
# Install Ruby 1.9.2-p290:
rbenv install 1.9.2-p290
rbenv global 1.9.2-p290
# 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
@lephuongbg
Copy link

@seifsallam, you can add source /etc/profile.d/rbenv.sh to your ~/bash.rc so you don't need to run that line again for each console instance.

@khebbie
Copy link

khebbie commented Feb 22, 2014

You also need sudo apt-get install libssl-dev

@science
Copy link

science commented Dec 18, 2014

Good start on instructions for global installation for rbenv. I'm not a linux expert but I think it's helpful to also set the "gid" bit on rbenv folders to ensure that as new folders are created they inherit from the group:

find /usr/local/rbenv -type d -exec chmod -R g+s '{}' \;

Additionally you are installing ruby-build as a separate installation. It's better to install it as an rbenv plugin:

mkdir -p /usr/local/rbenv/plugins/ruby-build
git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build

Then you should be able to say rbenv install 2.1.5 and get rbenv to do all the work (and configure/rehash itself after).

@elfassy
Copy link

elfassy commented Aug 7, 2015

echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh is causing an endless loop which ends up taking 100% memory on reboot. Anyone else have this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment