如何在Ubuntu系统上升级到Ruby 2.2?


13

我正在使用Ubuntu Linux。以下是uname信息

myuser@myinstance:~$ uname -a
Linux myinstance 3.18.0-52-generic #123-Ubuntu SMP Fri Feb 19 14:27:58 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

我正在尝试升级机器上的Ruby版本,该机器当前安装在

/usr/lib/ruby/1.9.1

我尝试按照这里的建议进行操作— 通过apt安装ruby 2.2.3,但不幸的是,我收到错误消息,“ / usr / bin / ruby​​2.2的替代路径不存在”。升级系统以使用Ruby 2.2或更高版本的正确方法是什么?

myuser@myinstance:~/racertracks$ sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.2 400 \
>  --slave /usr/bin/rake rake /usr/bin/rake2.2 \
>  --slave /usr/bin/ri ri /usr/bin/ri2.2 \
>  --slave /usr/bin/rdoc rdoc /usr/bin/rdoc2.2 \
>  --slave /usr/bin/gem gem /usr/bin/gem2.2 \
>  --slave /usr/bin/irb irb /usr/bin/irb2.2 \
>  --slave /usr/share/man/man1/ruby.1.gz ruby.1.gz /usr/share/man/man1/ruby2.2.1.gz \
>  --slave /usr/share/man/man1/rake.1.gz rake.1.gz /usr/share/man/man1/rake2.2.1.gz \
>  --slave /usr/share/man/man1/ri.1.gz ri.1.gz /usr/share/man/man1/ri2.2.1.gz \
>  --slave /usr/share/man/man1/rdoc.1.gz rdoc.1.gz /usr/share/man/man1/rdoc2.2.1.gz \
>  --slave /usr/share/man/man1/gem.1.gz gem.1.gz /usr/share/man/man1/gem2.2.1.gz \
>  --slave /usr/share/man/man1/irb.1.gz irb.1.gz /usr/share/man/man1/irb2.2.1.gz
update-alternatives: error: alternative path /usr/bin/ruby2.2 doesn't exist

Answers:


17

为什么不使用 16.04和17.10存储库中提供的ruby 2.3

sudo apt update sudo apt-get install ruby2.3 ruby2.3-dev

或尝试红宝石2.4或2.5

您可以通过Brightbox PPA获得这些

1)添加存储库

sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update

2)安装

sudo apt-get install ruby2.4

18.04

sudo apt-get install ruby2.5 ruby2.5-dev

可以在“ Brightbox”团队启动板页面上找到上述PPA中软件包状态的信息

或者,您可以尝试alternative path /usr/bin/ruby2.2 doesn't exist通过创建并重试错误来反向破解该错误sudo mkdir /usr/bin/ruby2.2

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.