如何卸载Ruby 1.8.7并安装Ruby 1.9.2?


20

有谁知道如何在Ubuntu 11.10上正确卸载Ruby 1.8.7并安装Ruby 1.9.2?

我已经进行了彻底的搜索,但没有找到有效的教程。

另外,我花了很长时间尝试使RVM正常工作,使用起来很痛苦。此外,对于旧版本,我将很少使用。

更新输出:

which ruby

/usr/local/bin/ruby

ls -l /usr/local/bin/ruby

lrwxrwxrwx 1 root root 16 2011-10-17 21:20 /usr/local/bin/ruby -> /usr/bin/ruby1.8

ls -l /etc/alternatives/ruby

lrwxrwxrwx 1 root root 18 2011-12-30 17:35 /etc/alternatives/ruby -> /usr/bin/ruby1.9.1

echo $PATH

/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

顺便说一句,当我查看--config gem时,它告诉我只有一个gem,即 /usr/bin/gem1.9.1

Answers:


30

两者都安装有问题吗?并使用存储库中的版本?我将使用以下命令安装ruby 1.9.2:

sudo apt-get install ruby1.9.1-full

然后更新“ alternatives”系统以使用ruby 1.9:

$ sudo update-alternatives --config ruby
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: 2
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

这也将设置为替代品erbirbrdocritestrb,该名男子页。但是,您需要单独更新gem命令:

$ sudo update-alternatives --config gem
There are 2 choices for the alternative gem (providing /usr/bin/gem).

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

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/gem1.9.1 to provide /usr/bin/gem (gem) in manual mode.

我知道,它被称为ruby1.9.1而不是1.9.2,这是一些上游debian包装的东西。


0

如果真的没有理由保留ruby1.8,我发现可以按以下步骤更轻松地删除它:

sudo apt-get remove ruby1.8

sudo apt-get install ruby1.9.3
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.