title: Installing Ruby 1.9.3 or later on EC2 - Ubuntu
body: <p>I'm trying to deploy using chef on EC2. I'm using knife ec2 to bootstrap t1.micro with Ubuntu 12.04 and LAMP stack. I get following error while chef tries to install packages as per its role.</p>
  
  <pre><code>Recipe Compile Error in /var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_rhel.rb
  ================================================================================
  
  
  NoMethodError
  -------------
  undefined method `require_relative' for main:Object
  
  
  Cookbook Trace:
  ---------------
    /var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_rhel.rb:3
  </code></pre>
  
  <p>Apparently it is because ruby version on EC2 during bootstrap is 1.8.7 and it doesn't have the above mentioned method. I tried tens of pages around web to upgrade it to 1.9.3 or more but the problem persists in several ways. I see the old ruby version when I do sudo rubo -v but latest when I do ruby -v. The problem is same even when I do sudo after logging in as root on EC2. Any one faced this problem while trying to install with Chef ? Any pointers to install ruby where I will be able to see the udpate version after sudo will be helpful. I unsuccesfully spent a whole day trying to figure out a correct solution.</p>