mystix
10/13/2012 - 3:53 PM

rbenv system-wide installation on Debian Squeeze

rbenv system-wide installation on Debian Squeeze

#!/bin/bash

aptitude update
aptitude -y install build-essential git-core zlib1g-dev libssl-dev libreadline6-dev




# rubygems: skip ri and rdoc on production server
echo '---
:sources:
- http://gems.rubyforge.org
- http://gems.github.com
gem: --no-ri --no-rdoc
' >> ~/.gemrc


# rbenv system-wide install
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
git clone git://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build

echo '# rbenv system-wide install
export RBENV_ROOT=/usr/local/rbenv
export PATH=$RBENV_ROOT/bin:$PATH
[[ -e "$RBENV_ROOT/bin/rbenv" ]] && eval "$(rbenv init -)"
' >> /etc/profile.d/rbenv.sh

ln -s /usr/local/rbenv/completions/rbenv.bash /etc/bash_completion.d/rbenv

# load rbenv
source /etc/profile.d/rbenv.sh




# install Ruby 1.9.3
CONFIGURE_OPTS="--with-readline-dir=/usr/include/readline" rbenv install 1.9.3-p327
rbenv global 1.9.3-p327

# rehash
rbenv rehash

# restart shell
exec $SHELL
#!/bin/bash

aptitude update
aptitude -y install build-essential git-core zlib1g-dev libssl-dev libreadline6-dev




# rubygems: skip ri and rdoc on production server
echo '---
:sources:
- http://gems.rubyforge.org
- http://gems.github.com
gem: --no-ri --no-rdoc
' >> ~/.gemrc




# rbenv: per-user install
echo '# rbenv per-user install
if [ -z "$(type rbenv 2> /dev/null | head -1 | grep function)" ]; then
    export RBENV_ROOT=/usr/local/rbenv
    export PATH=$RBENV_ROOT/bin:$PATH
    [[ -e "$RBENV_ROOT/bin/rbenv" ]] && eval "$(rbenv init -)"
fi' >> ~/.bashrc


# install Ruby 1.9.3
CONFIGURE_OPTS="--with-readline-dir=/usr/include/readline" rbenv install 1.9.3-p327
rbenv global 1.9.3-p327

# rehash
rbenv rehash

# restart shell
exec $SHELL