Saturday, January 28, 2012

Ubuntu 11.10, rbenv, ree 1.8.7 installation

I wanted to get away from rvm and start using rbenv. As of January 2012, there were some issues with installing ree on ubuntu 11.10 because of the openssl v2 issue found here. Here is how I set up my machine and with good success:

1) Remove all traces of rvm from my system:
sudo apt-get remove rvm-ruby
clean up my .bashrc (.bash_profile if that's you) to remove rvm

2) Install rbenv and ruby-build

3) Install ree. Now the trick to getting around the openssl issue here is not to use ree-1.8.7-2011.03 but to use ree-1.8.7-2011.12 instead:
ruby-build ree-1.8.7-2011.12

4) Set up my local environment using ~/.bash_profile Here is what I put in mine:
export GEM_HOME="$HOME/.localgems" # I created a ~/.localgems directory
export PATH="$HOME/.rbenv/bin:$HOME/.localgems/bin:$PATH" # Added the rbenv binary and .localgems/bin to my path

5) Set up my rails project to use the ruby I installed using ruby-build:
cd ~/Rails/my_project
rbenv local ree-1.8.7-2011.12

You should now have a .rbenv-version file in your project directory. This translates roughly to a .rvmrc file.

6) Bundler. I want bundler to manage my project gems instead of relying on rvm gemsets. To do this, I created the bundle config file for my user:
mkdir ~/.bundle
echo 'BUNDLE_PATH: vendor/bundle' >> ~/.bundle/config

7) Source your .bash_profile:
source ~/.bash_profile

8) Install bundler. Note: you will need rubygems installed. You can use sudo apt-get install rubygems if you are using ubuntu
gem install bundler

9) Enter your project and do your bundle install
cd ~/Rails/my_project
bundle install

YAY!

No comments:

Post a Comment