[英]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应该以
ruby19
或ruby1.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.