あなたが探しているのは Ruby バージョン マネージャー (rvm) だと思います。こちらから入手でき、Ruby、Rails、および Gem セットのバージョンを管理できます。
https://rvm.io/
ここにも優れた入門ガイドがあります: http://rvm.beginrescueend.com/rvm/install/
インストールの流れは次のとおりです。
[sam@mungr ~]$ \curl -L https://get.rvm.io | bash -s stable --ruby
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10956 100 10956 0 0 2240 0 0:00:04 0:00:04 --:--:-- 2240
Please read and follow further instructions.
Press ENTER to continue.
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1243k 100 1243k 0 0 570k 0 0:00:02 0:00:02 --:--:-- 929k
Installing RVM to /home/sam/.rvm/
Adding rvm PATH line to /home/sam/.bashrc /home/sam/.zshrc.
Adding rvm loading line to /home/sam/.bash_profile /home/sam/.zprofile.
# RVM: Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm/
# Screencast: http://screencasts.org/episodes/how-to-use-rvm
# In case of any issues read output of 'rvm requirements' and/or 'rvm notes'
Installation of RVM in /home/sam/.rvm/ is almost complete:
* To start using RVM you need to run `source /home/sam/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# sam,
#
# Thank you for using RVM!
# I sincerely hope that RVM helps to make your life easier and
# more enjoyable!!!
#
# ~Wayne
rvm 1.17.7 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
No binary rubies available for: downloads/ruby-1.9.3-p362.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /home/sam/.rvm/archives
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 460k 100 460k 0 0 342k 0 0:00:01 0:00:01 --:--:-- 492k
Extracting yaml to /home/sam/.rvm/src/yaml-0.1.4
Configuring yaml in /home/sam/.rvm/src/yaml-0.1.4.
Compiling yaml in /home/sam/.rvm/src/yaml-0.1.4.
Installing yaml to /home/sam/.rvm/usr
Installing Ruby from source to: /home/sam/.rvm/rubies/ruby-1.9.3-p362, this may take a while depending on your cpu(s)...
ruby-1.9.3-p362 - #downloading ruby-1.9.3-p362, this may take a while depending on your connection...
ruby-1.9.3-p362 - #extracting ruby-1.9.3-p362 to /home/sam/.rvm/src/ruby-1.9.3-p362
ruby-1.9.3-p362 - #extracted to /home/sam/.rvm/src/ruby-1.9.3-p362
ruby-1.9.3-p362 - #configuring
ruby-1.9.3-p362 - #compiling
ruby-1.9.3-p362 - #installing
Retrieving rubygems-1.8.24
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 371k 100 371k 0 0 430k 0 --:--:-- --:--:-- --:--:-- 611k
Extracting rubygems-1.8.24 ...
Removing old Rubygems files...
Installing rubygems-1.8.24 for ruby-1.9.3-p362 ...
Installation of rubygems completed successfully.
Saving wrappers to '/home/sam/.rvm/bin'.
ruby-1.9.3-p362 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p362 - #importing default gemsets (/home/sam/.rvm/gemsets/), this may take time ...
Install of ruby-1.9.3-p362 - #complete
Creating alias default for ruby-1.9.3-p362.
Recording alias default for ruby-1.9.3-p362.
Creating default links/files
Saving wrappers to '/home/sam/.rvm/bin'.
* To start using RVM you need to run `source /home/sam/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
完了すると、完全に機能する Ruby 1.9.3-p362 がインストールされます。
[sam@mungr ~]$ source /home/sam/.rvm/scripts/rvm
[sam@mungr ~]$ rvm list
rvm rubies
=* ruby-1.9.3-p362 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Rubyのどのバージョン?
[sam@mungr ~]$ which ruby
~/.rvm/rubies/ruby-1.9.3-p362/bin/ruby
少しハローワールド
[sam@mungr ~]$ ruby -e "puts 'Hello world'"
Hello world
編集#1
この質問について議論する過程で、著者のCrivensは、次のエラーが発生していることに気付きました。
エラー curl: (77) SSL CA 証明書の問題 (パス? アクセス権?) および OS は Linux バージョン 2.6.32-042stab055.16 (root@rh6-build-x64) (gcc バージョン 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) ) #1 SMP Fri Jun 8 19:22:28 MSD 2012. Ruby のシステム インストールを引き続き使用したいと考えています。
このエラーが発生した場合、通常は次の 2 つのいずれかを意味します。
1.この RPM、ca-certificates-2010.63-3.el6 が不足していると思います。これらは証明書です。Ubuntu 8.04.4 マシンへの RVM のインストールが失敗します。代わりにマルチユーザーとしてインストールする必要がありますか?
ソリューション #1
% yum install ca-certificates-2010.63-3.el6
2. rvm の開発者である Wayne は、URL を rvm.beginrescueend.com から rvm.io に変更し、おそらく SSL 証明書を取得しました。RVM を使用して Ruby 1.9.2 をインストールすると Curl 証明書エラーが発生する
解決策 2
% curl -L get.rvm.io | bash -s stable
-or-
% echo insecure > ~/.curlrc