如何在没有根访问的情况下安装rvm ?

时间:2021-10-30 07:15:36

I would like to install the travis gem on a machine without ruby gems, and on which I don't have root. (I want to encrypt something for use with travis.) I decided to try to install rvm, because https://rvm.io/rvm/install suggests that it is an easy way to install ruby without root. However, I ran into problems right away:

我想在没有ruby gems的机器上安装travis gem,而我没有ruby gem。(我想加密一些东西,以供特拉维斯使用。)我决定尝试安装rvm,因为https://rvm。io/rvm/install表明,在没有root用户的情况下安装ruby是一种简单的方法。然而,我马上就遇到了问题:

jgross@cagnode17:~$ \curl -L https://get.rvm.io | bash -s stable --ruby
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13961  100 13961    0     0  15390      0 --:--:-- --:--:-- --:--:--  170k
Please read and follow further instructions.
Press ENTER to continue.
Downloading RVM from wayneeseguin branch stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1083k  100 1083k    0     0   200k      0  0:00:05  0:00:05 --:--:--  199k

Installing RVM to /afs/csail.mit.edu/u/j/jgross/.rvm/
    RVM PATH line found in /afs/csail.mit.edu/u/j/jgross/.bashrc /afs/csail.mit.edu/u/j/jgross/.zshrc.
    RVM sourcing line found in /afs/csail.mit.edu/u/j/jgross/.bash_profile /afs/csail.mit.edu/u/j/jgross/.zprofile.
Installation of RVM in /afs/csail.mit.edu/u/j/jgross/.rvm/ is almost complete:

  * To start using RVM you need to run `source /afs/csail.mit.edu/u/j/jgross/.rvm/scripts/rvm`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

# Jason Gross,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne

# In case of problems:
#      run and read: rvm notes
#         read docs: http://rvm.io/
#        talk to us: http://webchat.freenode.net/?channels=rvm (http://freenode.net/faq.shtml#plusr)
#   read cheatsheet: http://cheat.errtheblog.com/s/rvm
#  watch screencast: http://screencasts.org/episodes/how-to-use-rvm
# open a bug report: https://github.com/wayneeseguin/rvm/issues

rvm 1.22.2 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

Searching for binary rubies, this might take some time.
Checking requirements for debian.
Installing requirements for debian.
jgross password required for 'apt-get --quiet --yes update': 
Sorry, try again.
jgross password required for 'apt-get --quiet --yes update': 
Sorry, try again.
jgross password required for 'apt-get --quiet --yes update': 
Sorry, try again.
sudo: 3 incorrect password attempts
Requirements installation failed with status: 1.

So I tried again:

所以我再次尝试:

jgross@cagnode17:~$ \curl -L https://get.rvm.io | bash -s stable --ruby
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13961  100 13961    0     0  27936      0 --:--:-- --:--:-- --:--:-- 27936
Please read and follow further instructions.
Press ENTER to continue.
Downloading RVM from wayneeseguin branch stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1083k  100 1083k    0     0   158k      0  0:00:06  0:00:06 --:--:--  186k

Upgrading the RVM installation in /afs/csail.mit.edu/u/j/jgross/.rvm/
    RVM PATH line found in /afs/csail.mit.edu/u/j/jgross/.bashrc /afs/csail.mit.edu/u/j/jgross/.zshrc.
    RVM sourcing line found in /afs/csail.mit.edu/u/j/jgross/.bash_profile /afs/csail.mit.edu/u/j/jgross/.zprofile.
Upgrade of RVM in /afs/csail.mit.edu/u/j/jgross/.rvm/ is complete.

# Jason Gross,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne

# In case of problems:
#      run and read: rvm notes
#         read docs: http://rvm.io/
#        talk to us: http://webchat.freenode.net/?channels=rvm (http://freenode.net/faq.shtml#plusr)
#   read cheatsheet: http://cheat.errtheblog.com/s/rvm
#  watch screencast: http://screencasts.org/episodes/how-to-use-rvm
# open a bug report: https://github.com/wayneeseguin/rvm/issues

Upgrade Notes:

  * No new notes to display.


rvm 1.22.2 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

Searching for binary rubies, this might take some time.
Checking requirements for debian.
Installing requirements for debian.
jgross password required for 'apt-get --quiet --yes update': 
Sorry, try again.
jgross password required for 'apt-get --quiet --yes update': 
sudo: 1 incorrect password attempt
Requirements installation failed with status: 1.
ruby-2.0.0-p247 is not installed.
Creating alias default for ruby-2.0.0-p247.
Recording alias default for ruby-2.0.0-p247.
Creating default links/files
ruby-2.0.0-p247 is not installed.
Could not load ruby ruby-2.0.0-p247.
/afs/csail.mit.edu/u/j/jgross/.rvm/scripts/alias: line 108: /afs/csail.mit.edu/u/j/jgross/.rvm/rubies/ruby-2.0.0-p247/bin/ruby: No such file or directory

  * To start using RVM you need to run `source /afs/csail.mit.edu/u/j/jgross/.rvm/scripts/rvm`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

Trying rvm install 1.8 gives me the same error message about debian requirements. Do I have any option other than giving up rvm and building ruby from source?

尝试rvm安装1.8会得到关于debian需求的相同错误信息。除了放弃rvm和从源代码构建ruby之外,我还有其他选择吗?

1 个解决方案

#1


17  

TL;DR

You're missing package dependencies needed to build Ruby.

您缺少构建Ruby所需的包依赖项。

Packages and Autolibs

The issue your facing is that recent(ish) versions of RVM use a feature called autolibs that attempt to install package dependencies. Of course, you need sudo access to install system packages. You could try installing a Ruby interpreter with:

您面临的问题是,最近的RVM版本使用了一个名为autolibs的特性,该特性试图安装包依赖项。当然,您需要sudo访问来安装系统包。您可以尝试安装一个Ruby解释器:

  • --autolibs=read-only - to avoid the sudo error, but this is unlikely to result in a working binary.
  • —autolibs=只读—以避免sudo错误,但这不太可能导致工作二进制。
  • --autolibs=rvm_pkg - will use the old rvm pkg install ... to install missing dependencies if they can be provided by RVM, this will take long time and is not guaranteed to work.
  • -autolibs=rvm_pkg -将使用旧的rvm pkg安装…若要安装RVM可以提供的缺失的依赖项,这将需要很长时间,而且不能保证有效。
  • --autolibs=read-fail - to avoid the sudo error, it will produce list of dependencies to install for the next section.
  • -autolibs=read-fail -为了避免sudo错误,它将生成下一节要安装的依赖项列表。

Ask Root to Install Package Dependencies

In general, the easiest solution is to ask root to install the packages that RVM expects. This should really be your first stop before doing anything else. There may be legitimate reasons to use static binaries or hand-build all your dependencies, but why not do things the easy way if you can?

通常,最简单的解决方案是让root安装RVM期望的包。这应该是你做任何事情之前的第一站。使用静态二进制文件或手工构建所有依赖项可能有合理的理由,但是如果可以,为什么不使用简单的方法呢?

Try Pre-Built, Static Binaries

If you can't get the necessary packages installed, you can try the rvm list remote command to see if there are any pre-built binaries for your system that can be installed by RVM. If you're missing packages, then you might want to look for a static binary that you can use with the rvm mount command. You might even build the interpreter on another system, and mount it using the appropriate remote URL; see rvm help mount for details.

如果无法安装所需的包,可以尝试使用rvm列表远程命令,看看是否存在可以由rvm安装的系统预构建的二进制文件。如果您丢失了包,那么您可能需要寻找一个静态二进制文件,您可以使用rvm挂载命令使用它。您甚至可以在另一个系统上构建解释器,并使用适当的远程URL将其挂载;详情请参见rvm帮助挂载。

#1


17  

TL;DR

You're missing package dependencies needed to build Ruby.

您缺少构建Ruby所需的包依赖项。

Packages and Autolibs

The issue your facing is that recent(ish) versions of RVM use a feature called autolibs that attempt to install package dependencies. Of course, you need sudo access to install system packages. You could try installing a Ruby interpreter with:

您面临的问题是,最近的RVM版本使用了一个名为autolibs的特性,该特性试图安装包依赖项。当然,您需要sudo访问来安装系统包。您可以尝试安装一个Ruby解释器:

  • --autolibs=read-only - to avoid the sudo error, but this is unlikely to result in a working binary.
  • —autolibs=只读—以避免sudo错误,但这不太可能导致工作二进制。
  • --autolibs=rvm_pkg - will use the old rvm pkg install ... to install missing dependencies if they can be provided by RVM, this will take long time and is not guaranteed to work.
  • -autolibs=rvm_pkg -将使用旧的rvm pkg安装…若要安装RVM可以提供的缺失的依赖项,这将需要很长时间,而且不能保证有效。
  • --autolibs=read-fail - to avoid the sudo error, it will produce list of dependencies to install for the next section.
  • -autolibs=read-fail -为了避免sudo错误,它将生成下一节要安装的依赖项列表。

Ask Root to Install Package Dependencies

In general, the easiest solution is to ask root to install the packages that RVM expects. This should really be your first stop before doing anything else. There may be legitimate reasons to use static binaries or hand-build all your dependencies, but why not do things the easy way if you can?

通常,最简单的解决方案是让root安装RVM期望的包。这应该是你做任何事情之前的第一站。使用静态二进制文件或手工构建所有依赖项可能有合理的理由,但是如果可以,为什么不使用简单的方法呢?

Try Pre-Built, Static Binaries

If you can't get the necessary packages installed, you can try the rvm list remote command to see if there are any pre-built binaries for your system that can be installed by RVM. If you're missing packages, then you might want to look for a static binary that you can use with the rvm mount command. You might even build the interpreter on another system, and mount it using the appropriate remote URL; see rvm help mount for details.

如果无法安装所需的包,可以尝试使用rvm列表远程命令,看看是否存在可以由rvm安装的系统预构建的二进制文件。如果您丢失了包,那么您可能需要寻找一个静态二进制文件,您可以使用rvm挂载命令使用它。您甚至可以在另一个系统上构建解释器,并使用适当的远程URL将其挂载;详情请参见rvm帮助挂载。