安装rvm
根据官网(https://www.rvm.io/)显示,只需执行以下两条命令即可安装:
# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
# \curl -sSL https://get.rvm.io | bash -s stable
执行完以上两条命令后会有如下提示:
* First you need to add all users that will be using rvm to 'rvm' group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# Administrator,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: https://rvm.io/help and https://twitter.com/rvm_io
根据如上提示,需执行,如下命令:
# source /etc/profile.d/rvm.sh
验证:
# rvm -v
rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
rvm安装ruby
查看ruby集:
# rvm list known
安装选定ruby版本:
# rvm install ruby-2.3
通过如上命令,同时也会安装gem。
使用选定ruby版本:
# rvm use ruby-2.3
设为默认ruby版本:
# rvm use ruby-2.3 --default
验证:
# ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]