11.04 / 11.10 上没有 ruby​​ 替代品?

11.04 / 11.10 上没有 ruby​​ 替代品?

运行update-alternatives --config ruby失败:

# uname -a
Linux test06 2.6.38-8-virtual #42-Ubuntu SMP Mon Apr 11 04:06:34 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION="Ubuntu 11.04"

# apt-get install ruby1.9.1-full
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ruby1.9.1-full is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.

# update-alternatives --config ruby
update-alternatives: error: no alternatives for ruby.

# ls -l /etc/alternatives/ru*
ls: cannot access /etc/alternatives/ru*: No such file or directory

2 天前 (2012 年 1 月 15 日) 我编写了一个 Puppet 清单,用于update-alternatives设置正确的 Ruby 版本。今天,update-alternatives 失败,如上所述。Ruby 替代品去哪了?

答案1

嗯,你需要安装多个版本的 ruby​​,因为可能有“ruby”的替代品(通常是 /usr/bin/ruby

如果你只安装了 ruby​​1.9.1,(ruby1.9.X),那么就没有可用的 alt。

例如,在 11.10 上,对于某些媒体应用程序,我需要同时安装 1.9.2 和 1.8,因此 update-alternatives 会反映这一点并允许我根据需要进行切换

$ sudo update-alternatives --config ruby
[sudo] password for doug: 
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/ruby1.8     50        auto mode
  1            /usr/bin/ruby1.8     50        manual mode
* 2            /usr/bin/ruby1.9.1   10        manual mode

Press enter to keep the current choice[*], or type selection number: 

默认情况下,在 11.04/11.10 中,“ruby”包提供 ruby​​1.8

相关内容