简体   繁体   English

如何使用rvm在Ubuntu 12.04上安装ruby 1.8.7?

[英]How to install ruby 1.8.7 on ubuntu 12.04 with rvm?

I'm working with a legacy rails system. 我正在使用旧版Rails系统。 I need a copy of ruby 1.8.7 I've just been given a new computer at work (finally) and it has ubuntu 12.04 我需要一份ruby 1.8.7副本,我刚得到一台正在使用的新计算机(最终),它具有Ubuntu 12.04。

Unfortunately I've just discovered that the rvm-rubies available for my system do not contain 1.8.7 (see list below) 不幸的是,我发现系统上可用的rvm-rubies不包含1.8.7(请参阅下面的列表)

How can I install ruby 1.8.7? 如何安装ruby 1.8.7? Is there another source that I can point to that will work? 我是否可以指出另一个来源?

Please note: I did not use apt-get to install rvm, that is not the problem 请注意:我没有使用apt-get安装rvm,那不是问题

This is the list of available rubies: 这是可用的红宝石列表:

# Rubies available for 'ubuntu/12.04/x86_64':

   ruby-1.9.3-p194
   ruby-1.9.3-p286
   ruby-1.9.3-p327
   ruby-1.9.3-p362
   ruby-1.9.3-p374
   ruby-1.9.3-p392
   ruby-1.9.3-p429
   ruby-1.9.3-p448
   ruby-2.0.0-p0
   ruby-2.0.0-p195
   ruby-2.0.0-p247

Edit: 编辑:

Just so you know, here's the output of some of the simpler rvm commands: 大家知道,这是一些更简单的rvm命令的输出:

triton:[~]% rvm list  

rvm rubies

# No rvm rubies installed yet. Try 'rvm help install'.

And rvm install gives this message (which make sit clear there is no version of 1.8.7 in the standard repository). 并且rvm install会显示此消息(请弄清楚标准存储库中没有1.8.7版本)。

triton:[~]% rvm install 1.8.7
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/12.04/x86_64/ruby-1.8.7-p374.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
You requested building with 'gcc-4.4' but it is not in your path.

From the documentation: 从文档中:

To install a specific tagged version of ruby from the repository we specify -t(tag name). 要从存储库中安装特定版本的红宝石,我们指定-t(标记名)。

It then goes on to talk about branches... 然后继续讨论分支...

Repository Branches (MRI) 储存库分支(MRI)

To install a specific branch version of ruby from the repository we specify --branch (branch name). 要从存储库中安装特定的红宝石分支版本,我们指定--branch(分支名称)。 Named rubies can help avoid clashes. 命名红宝石可以帮助避免冲突。

$ rvm install ruby-head -n zombie --branch ruby_1_8 && rvm ruby-head-zombie
$ ruby -v
ruby 1.8.8dev (2012-05-21) [i386-darwin10.8.0]
$ rvm install ruby-head -n newborn && rvm ruby-head-newborn
$ ruby -v
ruby 2.0.0dev (2012-06-03 trunk 35876) [x86_64-darwin10.8.0]

You'll find a list of all valid branches in the ruby repository: http://svn.ruby-lang.org/repos/ruby/branches/ 您将在ruby存储库中找到所有有效分支的列表: http : //svn.ruby-lang.org/repos/ruby/branches/

You have access to much more than what is shown. 您所获得的不仅仅是显示的内容。

ruby_1_3/
ruby_1_4/
ruby_1_6/
ruby_1_8/
ruby_1_8_5/
ruby_1_8_6/
ruby_1_8_7/
ruby_1_9_1/
ruby_1_9_2/
ruby_1_9_3/
ruby_2_0_0/

More hints on the RVM official website RVM官方网站上的更多提示

Also, for additional help, the IRC Chat room on freenode.net is awesome! 另外,对于其他帮助,freenode.net上的IRC聊天室很棒!

what you have presented is output from rvm list remote - which list binary (already compiled) rubies for your system, to see more possible choices of version run rvm list which will include 1.8.7 : 您所呈现的是从rvm list remote输出-列出了系统的二进制(已编译)红宝石,以查看版本rvm list更多可能选择,其中将包括1.8.7

# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p374]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3[-p448]
[ruby-]2.0.0-p195
[ruby-]2.0.0[-p247]
[ruby-]2.0.0-head
ruby-head

and it continues with number of other ruby distributions. 并且继续其他红宝石发行数量。

If not sure you can always just run: 如果不确定,您始终可以运行:

rvm install 1.8.7

RVM does all kind of detections and will most likely know what to do with specified version. RVM会进行所有类型的检测,并且很可能会知道如何处理指定的版本。

For future reference: I figured it out. 供将来参考:我想通了。

The important clue was in the last line of the result for rvm install: 重要线索是rvm install结果的最后一行:

You requested building with 'gcc-4.4' but it is not in your path.

I had gcc version 4.6 but my .zshrc (copied from my previous computer) was pointing at this older version. 我的gcc版本为4.6,但我的.zshrc(从以前的计算机复制)指向的是此旧版本。

Because of this, rvm thought I didn't have a c-compiler. 因此,rvm认为我没有C编译器。 Which means that rvm wasn't able to install any rubies from source - only pre-compiled rubies - which means it was restricted to only those already pre-compiled for my platform (ie 64-bit ubuntu 12.04) 这意味着rvm无法从源代码安装任何红宝石-只能预编译的红宝石-这意味着它仅限于已经针对我的平台进行预编译的那些(即64位ubuntu 12.04)

When I fixed the gcc line in my .zshrc - rvm was able to figure out how to install+compile source-code rubies - including v1.8.7 当我在.zshrc中修复gcc行时-rvm能够弄清楚如何安装+编译源代码红宝石-包括v1.8.7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM