简体   繁体   English

Amazon Linux最新红宝石

[英]Amazon Linux latest ruby

Amazon Linux 2012.03 now comes with ruby 1.9.3 Amazon Linux 2012.03现在随附ruby 1.9.3

To install it (as per the docs) 要安装它(根据文档)

sudo yum install ruby19

But ruby -v shows 1.8.7 . 但是ruby -v显示1.8.7 How would I switch it over 1.9.3 (If its already there there would be no need to use RVM yes?) 我如何将其切换到1.9.3(如果已经存在,则无需使用RVM是?)

The right way to do this on Amazon Linux is: 在Amazon Linux上执行此操作的正确方法是:

sudo yum update (to get latest version of Amazon Linux (2013.09 at time of this answer)
yum install ruby19 
alternatives --set ruby /usr/bin/ruby1.9

Supplementing @baboonWorksFine's answer, there are a number of 1.9 commands that can be symlinked as their undecorated equivalents. 作为对@baboonWorksFine答案的补充,有1.9个命令可以作为未修饰的等效命令进行符号链接。 What I did was: 我所做的是:

sudo -s
for f in /usr/bin/*1.9
do
  ln -s $f ${f%1.9}
done

That way, you don't accidentally miss any commands that need aliasing. 这样,您就不会偶然错过任何需要别名的命令。

If you do this: 如果您这样做:

ls -l /usr/bin/ruby*

you will probably see this: 您可能会看到以下内容:

lrwxrwxrwx 1 root root    7 Apr 26 18:27 /usr/bin/ruby -> ruby1.8
-rwxr-xr-x 1 root root 3720 Mar 29 08:29 /usr/bin/ruby1.8
-rwxr-xr-x 1 root root 3888 Mar 29 12:26 /usr/bin/ruby1.9

This is well self explained. 这是很好的自我解释。 So what you wanna do is: 因此,您想做的是:

rm /usr/bin/ruby && ln -s /usr/bin/ruby1.9 /usr/bin/ruby

Here is one simple solution and cleaner. 这是一个简单的解决方案和清洁器。

alternatives --config ruby

That will list all versions of Ruby you installed through yum. 这将列出您通过yum安装的所有Ruby版本。 All you have to do is choose the number listed there and hit enter. 您所要做的就是选择那里列出的数字,然后按Enter。

Ruby version 1.9 should be available under the name ruby19 or ruby1.9 . Ruby版本1.9应该以ruby19ruby1.9的名称ruby1.9 ruby is just a symbolic link that points to default version of ruby. ruby只是一个符号链接,指向默认版本的ruby。

I used @Ian Dickinson's answer, but added an "f" to the ln options to force it to overwrite the existing link. 我使用了@Ian Dickinson的答案,但在ln选项中添加了“ f”以强制其覆盖现有链接。 So the code is: 所以代码是:

sudo -s
for f in /usr/bin/*1.9
do
  ln -fs $f ${f%1.9}
done

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

相关问题 在Amazon Linux上安装ruby时出错 - Errors installing ruby on Amazon Linux 是否将Ruby USB代码移植到最新版本的Linux? - Porting Ruby USB code to latest versions of Linux? 使用Ruby 2.3.3的最佳Amazon linux AMI - Best Amazon linux AMI for using Ruby 2.3.3 如何在Amazon Linux系统中升级ruby版本? - How to upgrade ruby version in Amazon Linux system? 如何在 amazon linux 中将 ruby​​ 版本升级到 2.6.3 - How to upgrade ruby version to 2.6.3 in amazon linux Amazon Linux Standard 3.0 映像上缺少 AWS Codebuild Ruby 2.6.5 运行时 - AWS Codebuild Ruby 2.6.5 runtime missing on Amazon Linux Standard 3.0 image 无法在Amazon Linux上安装sqlite3 gem(已经安装了ruby和sqlite的开发库) - Cannot install sqlite3 gem on Amazon Linux (development libraries for ruby and sqlite already installed) 在我的下一个使用Amazon Web Services(Linux)的项目中该选择什么? Ruby / Python /其他,MySQL / PostgreSQL /其他 - What to chose for my next project with Amazon Web Services (Linux)? Ruby/Python/other, MySQL/PostgreSQL/other Cookbook 的深度依赖需要一个不可用的 Ruby 版本。 如何通过厨师规避 Amazon Linux? - Cookbook's deep dependency requires an unavailable Ruby version. How to circumvent via chef for Amazon Linux? 更新到最新版本的ruby - updating to the latest version of ruby
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM