Installing Ruby 2.0 on Dreamhost

Dreamhost run Ruby 1.8.7 which is over 3 years old. Criminal! 

Here’s what I had to do to upgrade to Ruby 2.0.

First of all, Ruby 2.0 is production ready. So, no need to worry about whether to go for 1.9.3. 

1. login as a sudo user (create one via the VPS > Admin Users section if you don’t have one)

i.e. login with your normal web user shell account and type sudo your_sudo_user 

2. get the latest version of rvm 

Note that this will not work as Dreamhost has a sudo user which cannot access files of the user that owns the files that sit in your webserver directory: 

rvm get stable 

So, use: 

\curl -L http://get.rvm.io | bash -s stable 

and then

source  

/home/your_sudo_user/.rvm/scripts/rvm 

3. run 

rvm requirements ruby-2.0.0 

You’re now done as your sudo user. Type exit to logout back into your original shell. 

4. you can’t write to rvm under your normal user so set rvm autolibs to read: 

rvm autolibs read 

and 

rvm install 2.0 

rvm use 2.0

5. Check stuff is set up correctly:

gem env gemhome

find $MY_RUBY_HOME -name psych.so

and you’re done. 

ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux] 

These help:

http://cheat.errtheblog.com/s/rvm

 

Leave a Reply

Your email address will not be published. Required fields are marked *