安裝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]