简体   繁体   English

如何在Fedora上升级Ruby

[英]How to upgrade Ruby on Fedora

I'm trying to upgrade Ruby to 1.8.7 on Fedora 13 (yes I know it's old) using rvm . 我正在尝试使用rvm在Fedora 13上将Ruby升级到1.8.7(是的,我知道它很旧)。 I'm a little new to the Ruby world, but this is what I've done so far: 我是Ruby世界的新手,但这是我到目前为止所做的:

~$ yum -y install rubygem-rvm
...
~$ rvm-install
...
~$ rvm install 1.8.7
/usr/local/rvm/rubies/ruby-1.8.7-p302, this may take a while depending on your cpu(s)...

ruby-1.8.7-p302 - #fetching 
ruby-1.8.7-p302 - #extracted to /usr/local/rvm/src/ruby-1.8.7-p302 (already extracted)
ruby-1.8.7-p302 - #configuring 
ruby-1.8.7-p302 - #compiling 
ruby-1.8.7-p302 - #installing 
ruby-1.8.7-p302 - #rubygems installing to ruby-1.8.7-p302
ruby-1.8.7-p302 - adjusting #shebangs for (gem).
ruby-1.8.7-p302 - #importing default gemsets (/usr/local/rvm/gemsets/)
Install of ruby-1.8.7-p302 - #complete 
~$ rvm use 1.8.7 --default
Using /usr/local/rvm/gems/ruby-1.8.7-p302
~$ ruby -v
ruby 1.8.6 (2010-09-02 patchlevel 420) [x86_64-linux]
~$ rvm use 1.8.7
Using /usr/local/rvm/gems/ruby-1.8.7-p302
~$ ruby -v
ruby 1.8.6 (2010-09-02 patchlevel 420) [x86_64-linux]

Everything seems to run fine, except Ruby 1.8.6 is still the default version. 除了Ruby 1.8.6仍然是默认版本外,其他一切似乎运行良好。

What other steps am I missing to switch the default Ruby version to 1.8.7? 将默认的Ruby版本切换到1.8.7,我还缺少其他什么步骤?

EDIT: It seems there's some really unintuitive behavior in rvm. 编辑:似乎在rvm中确实有一些不直观的行为。 If you don't install certain packages, then when you use rvm to install a specific Ruby version, rvm not only won't build or install that Ruby version, it won't even tell you it's not building Ruby. 如果您没有安装某些软件包,那么当您使用rvm安装特定的Ruby版本时,rvm不仅不会构建或安装该Ruby版本,甚至都不会告诉您它不在构建Ruby。 I noticed there was no bin directory in /usr/local/rvm/gems/ruby-1.8.7-p302...which was unusually, being that Ruby is a binary and all. 我注意到/usr/local/rvm/gems/ruby-1.8.7-p302中没有bin目录...这很不寻常,因为Ruby是二进制文件。 So I double checked the docs, and found a list of Fedora packages to install: 因此,我仔细检查了文档,并找到了要安装的Fedora软件包列表:

yum install -y bash curl git
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel
yum install -y iconv-devel

After those were installed, running rvm install 1.8.7 correctly built a Ruby binary. 安装rvm install 1.8.7这些文件后,运行rvm install 1.8.7正确构建一个Ruby二进制文件。 Oddly, running rvm use 1.8.7 --default still doesn't update the default Ruby version, so I did: 奇怪的是,运行rvm use 1.8.7 --default仍然不会更新默认的Ruby版本,所以我这样做了:

cp /usr/bin/ruby /usr/bin/ruby-1.8.6
rm -f /usr/bin/ruby
ln -s /usr/local/rvm/rubies/ruby-1.8.7-p302/bin/ruby /usr/bin/ruby

Be sure to run ruby -v in the same shell where you ran rvm use 1.8.7 . 确保在运行rvm use 1.8.7的同一外壳中运行ruby -v I'm not sure what the --default option does so try leaving it off. 我不确定--default选项的作用,因此请尝试将其保留。

Not positive, this could be a few things. 不是积极的,这可能是几件事。 My guess is this though. 我的猜测是这样。

You might need to switch the linker to point at your new installation (the "shortcut" file in /usr/bin/). 您可能需要切换链接器以指向您的新安装(/ usr / bin /中的“快捷方式”文件)。 Find where you installed your new version of ruby. 查找新版本的ruby的安装位置。 If the "ruby" linker in /usr/bin/ does not point to this new installation, make a new link by right-clicking on the ruby executable and make a link, put it /usr/bin/. 如果/ usr / bin /中的“ ruby​​”链接程序未指向此新安装,请通过右键单击ruby可执行文件并创建一个链接,将其放在/ usr / bin /中,以建立新链接。

That's my only guess, I had this problem when I installed a new version of python. 那是我唯一的猜测,当我安装新版本的python时遇到了这个问题。

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

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