Wednesday, August 22, 2012

Installing Ruby 1.9.3 from Source on Ubuntu 12.04

I have installed Ruby 1.9.3 on Ubuntu 12.04 from source.

1. Resources

Ruby Home page: Download
Setting Up Ubuntu 12.04 with Ruby 1.9.3
Install Ruby 1.9.3 with libyaml on CentOS


2. Dowload

Download the following files.

ruby-1.9.3-p194.tar.gz (http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz)
yaml-0.1.4.tar.gz (http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz)

Note that I needed yaml installed from its source because my first attempt of installation was not complete due to an error when I did:

$ gem --version
/usr/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.
1.8.23

3. Preparations

$ sudo apt-get update
$ sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl git-core python-software-properties

Note that despite including libyaml-dev, it failed on my first attemp; hence, a need to install yaml from source as shown next.

4. Install yaml from Source

$ cd Downloads/
$ tar -xvzf yaml-0.1.4.tar.gz
$ cd yaml-0.1.4/
$ ./configure
$ ./make
$ ./sudo make install

5. Install Ruby from Source

$ cd Downloads/
$ tar -xvzf ruby-1.9.3-p194.tar.gz
$ cd ruby-1.9.3-p194/
$ ./configure
$ ./make
$ ./sudo make install

6. Check


$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
$ gem --version
1.8.23
$ irb --version
irb 0.9.6(09/06/30)
$ irb
irb(main):001:0> 1+2
=> 3
irb(main):002:0> exit



No comments:

Post a Comment