簡介
可以通過源碼、RVM
或當前系統自帶的包管理(比如debian
的apt-get
)工具安裝
RVM
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
安裝完成後會出現如下日誌:
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:
* 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.
* Please do NOT forget to add your users to the rvm group.
The installer no longer auto-adds root or users to the rvm group. Admins must do this.
Also, please note that group memberships are ONLY evaluated at login time.
This means that users must log out then back in before group membership takes effect!
Thanks for installing RVM ?
Please consider donating to our open collective to help us maintain RVM.
根據提示執行:
source /etc/profile.d/rvm.sh
列出已知Ruby版本:
rvm list known
# 2.4.6
rvm install 2.4.6
修改rubygem爲國內源:
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
gem sources -l
# output: https://gems.ruby-china.com
# 確保只有 gems.ruby-china.com
Debian
我使用的是國內的deepin
系統,它是基於Debian
的系統,可以直接使用sudo apt-get install ruby-full
來安裝.