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

RubyDeploymentRvmSudo

Ruby Problem Overview


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?

Ruby Solutions


Solution 1 - Ruby

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.

Solution 2 - Ruby

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

Solution 3 - Ruby

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

Solution 4 - Ruby

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVitaliy YanchukView Question on Stackoverflow
Solution 1 - RubykwarrickView Answer on Stackoverflow
Solution 2 - RubylidaobingView Answer on Stackoverflow
Solution 3 - RubyGiliView Answer on Stackoverflow
Solution 4 - RubyGeshView Answer on Stackoverflow