Sunday, February 1, 2015

Installing Ruby on Mint 17, Using Ruby-install

I installed Ruby (2.1.3 and 2.2.0), using ruby-install on my Mint 17.

1. Resources

2. Installation of ruby-install

$ wget -O ruby-install-0.5.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz
$ tar -xzvf ruby-install-0.5.0.tar.gz
$ cd ruby-install-0.5.0/
$ sudo make install

3. Testing ruby-install

$ ruby-install --version
ruby-install: 0.5.0

$ ruby-install  # display supported rubies
Latest ruby versions:
  ruby:
    1.9.3-p547
    2.0.0-p576
    2.1.3
  jruby:
    1.7.16
  rbx:
    2.2.10
  maglev:
    1.0.0
  mruby:
    1.0.0

$ ruby-install --help
usage: ruby-install [OPTIONS] [RUBY [VERSION] [-- CONFIGURE_OPTS ...]]

Options:
 -r, --rubies-dir DIR Directory that contains other installed Rubies
 -i, --install-dir DIR Directory to install Ruby into
     --prefix DIR        Alias for -i DIR
     --system  Alias for -i /usr/local
 -s, --src-dir DIR Directory to download source-code into
 -c, --cleanup  Remove archive and unpacked source-code after installation
 -j, --jobs JOBS  Number of jobs to run in parallel when compiling
 -p, --patch FILE Patch to apply to the Ruby source-code
 -M, --mirror URL Alternate mirror to download the Ruby archive from
 -u, --url URL  Alternate URL to download the Ruby archive from
 -m, --md5 MD5  MD5 checksum of the Ruby archive
     --sha1 SHA1  SHA1 checksum of the Ruby archive
     --sha256 SHA256 SHA256 checksum of the Ruby archive
     --sha512 SHA512 SHA512 checksum of the Ruby archive
 --no-download  Use the previously downloaded Ruby archive
 --no-verify  Do not verify the downloaded Ruby archive
 --no-extract  Do not re-extract the downloaded Ruby archive
 --no-install-deps Do not install build dependencies before installing Ruby
 --no-reinstall   Skip installation if another Ruby is detected in same location
 -V, --version  Prints the version
 -h, --help  Prints this message

Examples:
 $ ruby-install ruby
 $ ruby-install ruby 2.0
 $ ruby-install ruby 2.0.0-p0
 $ ruby-install ruby -- --with-openssl-dir=...
 $ ruby-install -M https://ftp.ruby-lang.org/pub/ruby ruby
 $ ruby-install -M http://www.mirrorservice.org/sites/ftp.ruby-lang.org/pub/ruby ruby
 $ ruby-install -p https://raw.github.com/gist/4136373/falcon-gc.diff ruby 1.9.3

4. Install Latest Stable version of Ruby, using ruby-install

$ ruby-install ruby
>>> Installing ruby 2.1.3 into /home/(user)/.rubies/ruby-2.1.3 ...
>>> Installing dependencies for ruby 2.1.3 ...
.
.
>>> Successfully installed ruby 2.1.3 into /home/socrateos/.rubies/ruby-2.1.3
$ cd ~/.rubies/ruby-2.1.3/bin
$ ./ruby --version
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux] 

5. Install Latest version of Ruby (2.2.0), using ruby-install


$ ruby-install ruby 2.2.0
>>> Installing ruby 2.2.0 into /home/socrateos/.rubies/ruby-2.2.0 ...
>>> Installing dependencies for ruby 2.2.0 ...
.
.
>>> Successfully installed ruby 2.2.0 into /home/socrateos/.rubies/ruby-2.2.0
$ cd ~/.rubies/ruby-2.2.0/bin
$ ./ruby --version
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]

5. Change PATH environment variable


$ gedit ~/.profile
export PATH="$PATH:$HOME/.rubies/ruby-2.2.0/bin/"

Relogin and check.


$ ruby --version
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ irb
irb(main):001:0> RUBY_VERSION
=> "2.2.0"

No comments:

Post a Comment