Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@aiwilliams

This comment has been minimized.

Copy link

@aiwilliams aiwilliams commented Jun 21, 2012

Note that rbenv-install.sh expects to run with ~ as the working directory.

@kirs

This comment has been minimized.

Copy link

@kirs kirs commented Sep 15, 2012

Unfortunately your script doesn't work :(

$ gem install bundler
Fetching: bundler-1.2.0.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /usr/local/rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1 directory.

$ sudo gem install bundler
sudo: gem: command not found
@kirs

This comment has been minimized.

Copy link

@kirs kirs commented Sep 15, 2012

Do you plan to fix and update it somehow?

@fogonthedowns

This comment has been minimized.

Copy link

@fogonthedowns fogonthedowns commented Oct 25, 2012

Thanks!

@rubyfreak

This comment has been minimized.

Copy link

@rubyfreak rubyfreak commented Nov 20, 2012

Some comments would be helpful. Like when do I need one script vs the other and of it works on other versions of ubuntu.

@seifsallam

This comment has been minimized.

Copy link

@seifsallam seifsallam commented Feb 20, 2013

Everything is working great until i close the session. I'm using ubuntu 12.04, problem is I have to run source /etc/profile.d/rbenv.sh every time inorder to use rbenv

@lephuongbg

This comment has been minimized.

Copy link

@lephuongbg lephuongbg commented Jan 23, 2014

@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

This comment has been minimized.

Copy link

@khebbie khebbie commented Feb 22, 2014

You also need sudo apt-get install libssl-dev

@science

This comment has been minimized.

Copy link

@science 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

This comment has been minimized.

Copy link

@elfassy 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