Skip to content

Instantly share code, notes, and snippets.

@laptrinhcomvn
Created June 18, 2016 15:45
Show Gist options
  • Save laptrinhcomvn/6fdb105f0697d18442cf54028d2caf81 to your computer and use it in GitHub Desktop.
Save laptrinhcomvn/6fdb105f0697d18442cf54028d2caf81 to your computer and use it in GitHub Desktop.
Setup rbenv + ruby on Debian 7.1 (Wheezy)

Update and install required packages:

$ apt-get update -y
$ apt-get install -y g++ gcc make libc6-dev patch openssl ca-certificates libreadline6 libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev

Install ruby-build

$ git clone git://github.com/sstephenson/ruby-build.git /tmp/ruby-build
$ cd /tmp/ruby-build/
$ ./install.sh

Install rbenv

$ RBENV_ROOT="/usr/local/rbenv"
$ git clone git://github.com/sstephenson/rbenv.git $RBENV_ROOT
$ echo 'export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh
$ echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh
$ echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
$ chmod +x /etc/profile.d/rbenv.sh
$ source /etc/profile.d/rbenv.sh
$ export PATH=$PATH:/usr/local/bin

Install Ruby and set as global Ruby

$ RUBY=2.0.0-p247
$ rbenv install -k $RUBY
$ rbenv global $RUBY
$ rbenv rehash

Other gems

$ echo "gem: --no-ri --no-rdoc" > /etc/gemrc
$ cp /etc/gemrc ~/.gemrc
$ cp /etc/gemrc /etc/skel/.gemrc
$ gem install bundler
$ rbenv rehash

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment