ruby 如何在不授予 RVM 用户 sudo 访问权限的情况下安装 RVM 系统要求

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16563115/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 05:56:57  来源:igfitidea点击:

How to install RVM system requirements without giving sudo access for RVM user

rubydeploymentrvmsudo

提问by Vitaliy Yanchuk

On my Debian server I have a user called "deployer" that does not have sudoaccess, and has RVM installed.

在我的 Debian 服务器上,我有一个名为“deployer”的用户,该用户没有sudo访问权限,并且安装了 RVM。

When installing Ruby using "deployer", like 1.9.3, it triggers a task to install dependencies

使用“deployer”安装 Ruby 时,如 1.9.3,它会触发安装依赖项的任务

"Installing requirements for debian, might require sudo password."

which fails and stops installation because "deployer" can not sudo.

失败并停止安装,因为“部署者”不能 sudo。

I don't want to add "deployer" into the sudoers list, and don't want to install RVM for some other user just for a one-time use for installing dependencies.

我不想将“部署者”添加到 sudoers 列表中,也不想为其他用户安装 RVM 只是为了一次性安装依赖项。

What is the correct way to install that dependencies? Or how do I list them to install manually?

安装该依赖项的正确方法是什么?或者我如何列出它们以手动安装?

回答by kwarrick

This is indeed a new feature of RVM called autolibs, which automatically installs dependencies.

这确实是 RVM 的一个新特性,称为autolibs,它会自动安装依赖项。

If you have already installed RVM, and it is asking you for your sudopassword, you can disable autolibs:

如果您已经安装了 RVM,并且它要求您输入sudo密码,您可以禁用自动库:

$ rvm autolibs disable
$ rvm requirements # manually install these
$ rvm install ruby

Otherwise, you can install RVM without autolibs with this command:

否则,您可以使用以下命令安装没有自动库的 RVM:

$ \curl -L https://get.rvm.io | bash -s -- --autolibs=read-fail

I understand the motivation, but find it rather annoying. I do not want to put my sudo password into RVM, nor for that matter Bundle! Please community, stop doing this.

我理解动机,但觉得它很烦人。我不想将我的 sudo 密码放入 RVM,也不想将 Bundle 放入!请社区,停止这样做。

回答by lidaobing

I prefer this

我更喜欢这个

$ rvm autolibs fail
$ rvm install ruby
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/ubuntu/12.04/x86_64/ruby-2.1.1.tar.bz2
Checking requirements for ubuntu.
Missing required packages: gawk g++ gcc make libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev
RVM autolibs is now configured with mode '2' => 'check and stop if missing',
please run `rvm autolibs enable` to let RVM do its job or run and read `rvm autolibs [help]`
or visit https://rvm.io/rvm/autolibs for more information.
Requirements installation failed with status: 1.

then I can relogin with root and run

然后我可以用root重新登录并运行

# apt-get install gawk g++ gcc make libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev

回答by Gili

The accepted answerfails to install Ruby into .rvm/bin/ruby. The shell script ends up in .rvm/wrappers/ruby-2.0.0-p247/rubywhich is a pain if your build script depends on this location and the version number changes over time.

接受的答案未能红宝石安装到.rvm/bin/ruby.rvm/wrappers/ruby-2.0.0-p247/ruby如果您的构建脚本依赖于这个位置并且版本号随着时间的推移而变化,那么shell 脚本最终会很痛苦。

Here is an easier solution that worked for me:

这是一个对我有用的更简单的解决方案:

\curl -L https://get.rvm.io | bash -s -- --ignore-dotfiles --autolibs=0 --ruby

.rvm/bin/rubyis created as expected.

.rvm/bin/ruby按预期创建。

Source: http://blog.sunild.com/2013/07/install-ruby-with-rvm-on-mac-os-108.html

来源http: //blog.sunild.com/2013/07/install-ruby-with-rvm-on-mac-os-108.html

回答by Gesh

The problem was introduced somewhere in the latest RVM versions. Don't know exactly when, but definitely in the past 3-4 months.

这个问题是在最新的 RVM 版本中引入的。不知道确切的时间,但肯定是在过去的 3-4 个月内。

Try this:

尝试这个:

rvm get 1.18.8
rvm install <whichever-version-you-want>

I don't know exactly when on the path between 1.18.8 and 1.20.12 that problem got introduced, but for me the installation works with RVM v1.18.8 and fails with v1.20.12.

我不知道在 1.18.8 和 1.20.12 之间的路径上的确切时间,该问题被引入,但对我而言,安装适用于 RVM v1.18.8 并在 v1.20.12 中失败。