public
Created — forked from mhutter/bootstrap-ruby.sh

Install Ruby with rbenv/ruby-build on Ubuntu 10.04 with openssl

  • Download Gist
bootstrap-ruby.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
#!/bin/bash
set -e # exit on error
### README
# * built for Ubuntu (Lucid Lynx)
# * uses GIT via SSH because of !@#$% proxy at work
# * installs your desired ruby version (1.9.2-p290 per default) 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 .profile
### /README
 
### CONFIG
# Ruby Version to install
RBVER='1.9.2-p290'
### /CONFIG
 
 
PROFILE=~/.profile
# update system, just in case
sudo aptitude update
#sudo aptitude full-upgrade
 
# install some dependancies
sudo aptitude install -y \
build-essential zlib1g-dev \
sqlite3 libsqlite3-dev \
libssl-dev openssl \
libreadline-dev \
curl wget git-core
 
# build-essential zlib1g-dev required to install ruby
# sqlite3 libsqlite3-dev required for sqlite gem
# libssl-dev openssl required for openssl extension
# libreadline-dev required for IRB
# curl wget git-core can i haz tools?
 
cd
### Install rbenv
test -d ~/.rbenv || git clone git@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
# reload shell
source $PROFILE
 
### Install ruby-build
test -d ~/ruby-build || git clone git@github.com:sstephenson/ruby-build.git ~/ruby-build
cd ~/ruby-build && sudo ./install.sh
 
### Install Ruby
rbenv install $RBVER --with-openssl-dir=/usr/local
# reload binaries
rbenv rehash
# set as default version
rbenv global $RBVER
 
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 ==='
 
# install bundler
gem install bundler
rbenv rehash
grep 'BUNDLE_WITHOUT' $PROFILE &>/dev/null || echo 'export BUNDLE_WITHOUT=production' >> $PROFILE

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.