Skip to content

Instantly share code, notes, and snippets.

@amejiarosario
Forked from dillera/rbenv-lucid
Created May 22, 2012 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amejiarosario/2769239 to your computer and use it in GitHub Desktop.
Save amejiarosario/2769239 to your computer and use it in GitHub Desktop.
rbenv for ubuntu
#!/bin/bash
set -e # exit on error
### README
# * installs your desired ruby versions using rbenv
# ** including openssl (needed by bundler)
# ** including sqlite (probably needed for rails apps)
#
# Before you start:
# * put ssh-keys in place
# * $ ssh git@github.com
# * If you're behind a proxy, be sure to set $http_proxy etc!
#
# After the Script has run:
# * reload your .bash_profile
### /README
### CONFIG
# Ruby Versions to install
RBVER187='1.8.7-p357'
RBVER192='1.9.2-p320'
RBVER193='1.9.3-p194'
RBVER_GLOBAL=${RBVER193}
PROFILE=~/.profile
#MYPROXY="http://proxy:3128"
### /CONFIG
# install some dependancies (requires root)
sudo aptitude install build-essential
sudo aptitude install libcurl3-openssl-dev libsqlite-dev libreadline-dev libxml2-dev libxslt1-dev curl wget git-core
cd
### Install rbenv, setup your profile of choice
test -d ~/.rbenv || git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
# modify $PATH and autoload rbenv
grep 'rbenv/bin' $PROFILE &>/dev/null || echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $PROFILE
grep 'rbenv init' $PROFILE &>/dev/null || echo 'eval "$(rbenv init -)"' >> $PROFILE
grep 'unset RUBYLIB' $PROFILE &>/dev/null || echo 'unset RUBYLIB' >> $PROFILE
# reload shell
source $PROFILE
### Install ruby-build
test -d ~/ruby-build || git clone https://github.com/sstephenson/ruby-build.git ~/ruby-build
cd ~/ruby-build && sudo ./install.sh
### Install Rubies, 1.8.7, 1.9.2, 1.9.3
rbenv install $RBVER192 --with-openssl-dir=/usr/lib64
rbenv install $RBVER187 --with-openssl-dir=/usr/lib64
rbenv install $RBVER193 --with-openssl-dir=/usr/lib64
# reload binaries
rbenv rehash
# set as default version
rbenv global $RBVER_GLOBAL
ruby -v
# set some defaults
test -s ~/.gemrc || echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc
echo 'Here is your ~/.gemrc:'
cat ~/.gemrc
echo '=== end of .gemrc ==='
# reload shell
source $PROFILE
rbenv rehash
#grep 'BUNDLE_WITHOUT' $PROFILE &>/dev/null || echo 'export BUNDLE_WITHOUT=production' >> $PROFILE
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment