Skip to content

Instantly share code, notes, and snippets.

@dillera
Last active October 5, 2015 05:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dillera/2760597 to your computer and use it in GitHub Desktop.
Save dillera/2760597 to your computer and use it in GitHub Desktop.
rbenv for ubuntu lucid
#!/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
RBVER192='1.9.2-p290'
RBVER187='1.8.7-p357'
RBVER193='1.9.3-rc1'
RBVER_GLOBAL=${RBVER192}
PROFILE=~/.bash_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
gem install actionmailer -v=2.3.8
gem install actionpack -v=2.3.8
gem install activesupport -v=2.3.8
gem install highline -v=1.6.1
gem install json -v=1.6.5
gem install mime-types -v=1.16
gem install nokogiri -v=1.4.3.1
gem install rest-client -v=1.6.1
gem install i18n -v=0.6.4
gem install bundler -v=1.2.1
gem install capistrano -v=2.12
rbenv rehash
grep 'BUNDLE_WITHOUT' $PROFILE &>/dev/null || echo 'export BUNDLE_WITHOUT=production' >> $PROFILE
* If you are behind a proxy
gem install -p http://proxy:3128 actionmailer -v=2.3.8
gem install -p http://proxy:3128 actionpack -v=2.3.8
gem install -p http://proxy:3128 activesupport -v=2.3.8
gem install -p http://proxy:3128 highline -v=1.6.1
gem install -p http://proxy:3128 json -v=1.6.5
gem install -p http://proxy:3128 mime-types -v=1.16
gem install -p http://proxy:3128 nokogiri -v=1.4.3.1
gem install -p http://proxy:3128 rest-client -v=1.6.1
gem install -p http://proxy:3128 i18n -v=0.6.4
gem install -p http://proxy:3128 bundler -v=1.2.1
gem install -p http://proxy:3128 capistrano -v=2.12
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment