RVM(Ruby Version Manager)安装和使用

本文介绍了如何在Linux系统中安装RVM(Ruby Version Manager),包括通过修改源和使用sudo安装,以及添加用户到rvm组,管理和切换Ruby版本。此外,还提供了查看已安装和可用Ruby版本的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装RVM

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3


\curl -sSL https://get.rvm.io | sudo bash -s stable

https 如果连不上,tmd GFW,就改成http就可以了。


sudo 方式会安装在 /usr/local/rvm ,供所有用户使用,否则只是安装在当前用户的HOME下。

执行完之后,会提醒:


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.





将用户加入到刚安装脚本创建的rvm组

usermod -a -G rvm root redmine

检查用户所在的组:groups root











当前安装的ruby

# rvm list

所有可以安装的rubies

# rvm list known



Install a version of Ruby (eg 2.1.1):

rvm install 2.1



Use the newly installed Ruby:

rvm use 2.1



当前正在使用的ruby版本:

ruby -v

ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]



为每个shell设定默认的ruby版本,注意:这将覆盖系统的ruby

rvm use 2.1 --default



ruby版本的信息(已安装,会包含安装文件位置,一般是都在 /usr/local/rvm 下面)

rvm info 1.9.3
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值