ruby安装及gem源配置

简介

可以通过源码、RVM或当前系统自带的包管理(比如debianapt-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来安装.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
码编译安装 Chef Solo 分为以下几个步骤: 1. 安装 RubyRubyGems:Chef Solo 是基于 Ruby 编写的,所以需要先安装 RubyRubyGems。您可以使用操作系统的包管理器安装,或者从官方网站下载代码编译安装安装完成后,请验证 RubyRubyGems 是否安装成功。 2. 安装 Chef 和依赖组件:Chef Solo 是 Chef 的一个独立组件,需要先安装 Chef 和依赖组件。您可以使用 RubyGems 安装,命令如下: ``` gem install chef ``` 安装完成后,请验证 Chef 是否安装成功。 3. 下载 Chef Solo 代码:您可以从官方网站下载最新版本的 Chef Solo 代码,或者使用以下命令从 GitHub 上下载: ``` git clone https://github.com/chef/chef.git ``` 4. 编译和安装 Chef Solo:使用以下命令编译和安装 Chef Solo: ``` cd chef/chef-solo gem build chef-solo.gemspec gem install chef-solo-<version>.gem ``` 其中,`<version>` 是 Chef Solo 的版本号,您需要将其替换为实际的版本号。安装完成后,请验证 Chef Solo 是否安装成功。 5. 配置 Chef Solo:将您的 Chef Solo 配置文件(通常是 solo.rb 和 json 文件)放置在合适的目录下,并确保您的配置文件正确。可以使用 `chef-solo -c <config_file>` 命令来验证配置文件是否正确。 6. 使用 Chef Solo:使用 `chef-solo -c <config_file>` 命令来启动 Chef Solo,并运行您的 Chef 配方(cookbooks)。 希望这个步骤对您有所帮助,如果您有其他问题,请随时问我。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值