-
-
Save amejiarosario/2769239 to your computer and use it in GitHub Desktop.
rbenv for ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 [email protected] | |
# * 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