73

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?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Vitaliy Yanchuk
  • 1,463
  • 1
  • 11
  • 22

4 Answers4

167

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.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
kwarrick
  • 5,930
  • 2
  • 26
  • 22
  • 6
    Thank you, I've wasted a lot of time with this. What were they thinking? – Alex Dean Aug 21 '13 at 17:03
  • 4
    Out of curiosity, why is `curl` prefixed with a slash? Is that a typo? – Gili Sep 09 '13 at 23:14
  • 13
    @Gili The backslash will bypass an existing alias, which may have additional unwanted flags. – kwarrick Sep 10 '13 at 04:06
  • 4
    One main purpose of virtualenvs is to avoid using root privileges, which asking for root password entirely ruins it. – mehdix Jun 12 '15 at 09:18
  • @MehdiSadeghi I couldn't agree more. Your comment is perfect. – tadasajon Sep 07 '15 at 15:31
  • Why am I getting `No checksum for downloaded archive, recording checksum in user configuration.` in the `install ruby` step?... How do I validate it? – stf Mar 09 '16 at 16:24
  • I wonder why they do not add this to installation steps in `rvm` site. Don't they understand that a lot,if not most, people will not want to perform a privileged installation? – Jannis Ioannou Apr 30 '20 at 15:50
  • I think you need to say `rvm autolibs read-fail` now instead of `... disable` or `rvm requirements` will say nothing. – vlz Oct 13 '22 at 17:29
38

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
lidaobing
  • 1,005
  • 13
  • 26
6

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

Community
  • 1
  • 1
Gili
  • 86,244
  • 97
  • 390
  • 689
-1

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.

Gesh
  • 433
  • 3
  • 9