如何在 linux (ubuntu) 上更新 ruby​​?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1403278/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 17:41:04  来源:igfitidea点击:

How to update ruby on linux (ubuntu)?

rubylinuxubuntuinstallation

提问by eKek0

I'm newbie on both ruby and linux, so I'm sure this is trivial but I don't know yet. I currently have ruby 1.8.7 installed and I want to update it to ruby 1.9. How can I do that?

我是 ruby​​ 和 linux 的新手,所以我确定这是微不足道的,但我还不知道。我目前安装了 ruby​​ 1.8.7,我想将其更新为 ruby​​ 1.9。我怎样才能做到这一点?

采纳答案by Mark Rushakoff

sudo apt-get install ruby1.9

should do the trick.

应该做的伎俩。

You can find what libraries are available to install by

您可以找到可用于安装的库

apt-cache search <your search term>

So I just did apt-cache search ruby | grep 9to find it.

所以我只是apt-cache search ruby | grep 9为了找到它。

You'll probably need to invoke the new Ruby as ruby1.9, because Ubuntu will probably default to 1.8 if you just type ruby.

您可能需要将新的 Ruby 调用为ruby1.9,因为如果您只键入 ,Ubuntu 可能会默认为 1.8 ruby

回答by Ronald Pottol

First, which version of ubuntu are you using, it might be easiest to just upgrade to one that has it.

首先,您使用的是哪个版本的 ubuntu,升级到拥有它的版本可能是最简单的。

Next, enable backports (system menue, adminstration, software sources), and search for in in synaptic.

接下来,启用向后移植(系统菜单、管理、软件源),并在突触中搜索。

Last, look for a ppa for it.

最后,为它寻找一个ppa。

回答by Chris

There's really no reason to remove ruby1-8, unless someone else knows better. Execute the commands below to install 1.9 and then link ruby to point to the new version.

真的没有理由删除 ruby​​1-8,除非其他人知道得更好。执行以下命令安装1.9,然后链接ruby指向新版本。

sudo apt-get install ruby1-9 rubygems1-9
sudo ln -sf /usr/bin/ruby1-9 /usr/bin/ruby

回答by mikewilliamson

Generally the verions of programs are linked to the version of your operating system. So if you were running gutsy you would either have to upgrade to the new jaunty Hymanalope version which has ruby 1.9 or add the respoistories for jaunty to your /etc/apt/sources.list file. Once you have done that you can start up the synaptic package manager and you should see it in there.

通常,程序的版本与您的操作系统版本相关联。因此,如果您正在运行 Gutsy,您要么必须升级到具有 ruby​​ 1.9 的新 jaunty Hymanalope 版本,要么将 jaunty 的资源库添加到您的 /etc/apt/sources.list 文件中。完成后,您可以启动突触包管理器,您应该在那里看到它。

回答by kenobi

the above is not bad, however its kinda different for 11.10

以上还不错,但是对于 11.10 有点不同

sudo apt-get install ruby1.9 rubygems1.9

that will install ruby 1.9

这将安装 ruby​​ 1.9

when linking, you just use ls /usr/bin | grep rubyit should output ruby1.9.1

链接时,您只需使用ls /usr/bin | grep ruby它应该输出ruby1.9.1

so then you sudo ln -sf /usr/bin/ruby1.9.1 /usr/bin/rubyand your off to the races.

那么你sudo ln -sf /usr/bin/ruby1.9.1 /usr/bin/ruby和你的比赛。

回答by Konrad Reiche

The author of this articleclaims that it would be best to avoid installing Ruby from the local packet manager, but to use RVMinstead.

这篇文章的作者声称最好避免从本地数据包管理器安装 Ruby,而是使用RVM

You can easily switch between different Ruby versions:

您可以轻松地在不同的 Ruby 版本之间切换:

rvm use 1.9.3

etc.

等等。

回答by Zorayr

On Ubuntu 12.04 (Precise Pangolin), I got this working with the following command:

在 Ubuntu 12.04 (Precise Pangolin) 上,我使用以下命令进行了操作:

sudo apt-get install ruby1.9.1
sudo apt-get install ruby1.9.3

回答by ucefkh

If you are like me using ubuntu 10.10& cant find the lastest version which is now

如果您像我一样使用ubuntu 10.10 并且找不到现在的最新版本

  • ruby1.9.3
  • 红宝石1.9.3

this is where you can get it http://www.ubuntuupdates.org/package/brightbox_ruby_ng_experimental/maverick/main/base/ruby1.9.3

这是你可以得到它的地方 http://www.ubuntuupdates.org/package/brightbox_ruby_ng_experimental/maverick/main/base/ruby1.9.3

or download the *.debfile :)

或下载*.deb文件:)

& remember that it wont alter you old versionof ruby

并记住它不会改变你旧版本的 ruby

回答by user7542

Ruby is v2.0 now. Programs like Jekyll (and I am sure many others) require it. I just ran:

Ruby 现在是 v2.0。像 Jekyll 这样的程序(我相信还有很多其他程序)需要它。我刚跑:

sudo apt-get install ruby2.0

sudo apt-get install ruby2.0

check version

检查版本

ruby --version

Hope that helps

希望有帮助