How to install RVM system requirements without giv

2019-01-16 02:36发布

问题:

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

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

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

which fails and stops installation because "deployer" can not 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.

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

回答1:

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

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

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

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

$ \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.



回答2:

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

# 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


回答3:

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

Here is an easier solution that worked for me:

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

.rvm/bin/ruby is created as expected.

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



回答4:

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

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.