如何在没有root访问权限的情况下安装rvm?

时间:2013-08-17 01:57:18

标签: ruby installation rvm

我想在没有ruby gems的机器上安装travis gem,并且我没有root。 (我想加密与travis一起使用的东西。)我决定尝试安装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.

所以我再试一次:

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.

尝试rvm install 1.8给出了有关debian要求的相同错误消息。除了放弃rvm并从源代码构建ruby之外,我还有其他选择吗?

1 个答案:

答案 0 :(得分:18)

TL; DR

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

包和自动填充

您面临的问题是最近(某些)版本的RVM使用名为autolibs的功能来尝试安装包依赖项。当然,您需要 sudo 访问才能安装系统软件包。您可以尝试使用以下命令安装Ruby解释器:

  • --autolibs=read-only - 避免 sudo 错误,但这不太可能导致工作二进制文件。
  • --autolibs=rvm_pkg - 如果可以由RVM提供,将使用旧的rvm pkg install ...来安装缺少的依赖项,这将花费很长时间并且无法保证可以正常工作。
  • --autolibs=read-fail - 为了避免 sudo 错误,它会生成要为下一部分安装的依赖项列表。

要求Root安装包依赖

通常,最简单的解决方案是向root用户询问RVM所期望的install the packages。在做其他任何事情之前,这应该是你的第一站。可能有合理的理由使用静态二进制文件或手工构建所有依赖项,但如果可以的话,为什么不以简单的方式做事?

尝试预建的静态二进制文件

如果无法安装必要的软件包,可以尝试使用rvm list remote命令查看是否有任何可由RVM安装的系统预构建二进制文件。如果您缺少软件包,那么您可能希望查找可以与rvm mount命令一起使用的静态二进制文件。您甚至可以在另一个系统上构建解释器,并使用适当的远程URL挂载它;有关详细信息,请参阅rvm help mount