Categories
Ruby

Bluehost Rails 3.2.8 Ruby 1.9.3

This is my bluehost environment:
# ruby --version
ruby 1.8.7 (2012-02-08 MBARI 8/0x6770 on patchlevel 358) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2012.02
# rails -v
Rails 2.3.11

I need to upgrade the ruby and rails version, take a Live Chat with Bluehost support, the guy let me follow this post https://my.bluehost.com/cgi/help/rails but it just tell us how to deploy the rails, so I need to reinstall the rails.

Install Ruby 1.9

When I install RubyGems, it complains:

[~/src/rubygems-1.8.24]# ruby setup.rb
/home4/lytsingo/.local/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
RubyGems 1.8.24 installed

so need to install libyaml first

# mkdir ~/src
# cd ~/src
# wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
# tar xvf yaml-0.1.4.tar.gz
# cd yaml-0.1.4
# ./configure -prefix=$HOME/.local
# make -j8
# make install
# make clean

*Note*: Let compile faster, I use make -j 8, it depends your cpu processors, see:

cat /proc/cpuinfo |grep processor |wc -l
8

# wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
# tar xvf ruby-1.9.3-p0.tar.gz
# cd ruby-1.9.3-p0
# ./configure -prefix=$HOME/.local --disable-install-doc --with-opt-dir=$HOME/.local
# make -j8
# make install
# make clean

Install gems

# wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
# tar xvf rubygems-1.8.24.tgz
# cd rubygems-1.8.24
# ruby setup.rb 

Install Rails 3

gem install rails -v 3.2.8 --no-rdoc --no-ri

Check it out:

# ruby -v
ruby 1.9.3p0 (2011-10-30) [x86_64-linux]
# rails -v
Rails 3.2.8

Em, it looks so nice, enjoy!