gpt4 book ai didi

ruby - 在 (K)Ubuntu 17.10 上安装 ruby​​ 2.4 的最佳方法是什么?

转载 作者:数据小太阳 更新时间:2023-10-29 08:18:05 27 4
gpt4 key购买 nike

我运行 Kubuntu,并想安装最新的稳定 Ruby 版本,在撰写本文时为 2.4.2。不幸的是,Ubuntu 有点落后:17.10 有这个:

$ ruby --version  
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
$

我用谷歌搜索,看到了很多建议,但没有一个是优雅的。我不想使用 rvm(这没什么问题——我只是想更新我的“基础” ruby )。从源代码构建是可以的,除了它至少会默认安装在/usr/local 下的某个地方,并将保留旧版本。我想升级到 2.4.2 - 可能使用 rvm 安装 2.5。

我已经尝试使用下面评论中的建议。ppa 似乎没有 2.4。当我使用 apt install ruby​​ 2.4* 时,* 是一个正则表达式,因此匹配 2.{anything_or_nothing},因此尝试引入 2.3,这不是我想要的 - 例如

$ sudo apt install ruby2.4*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'ruby2.3' for regex 'ruby2.4*'
Note, selecting 'uwsgi-plugin-rack-ruby2.3' for regex 'ruby2.4*'
Note, selecting 'ruby2.3-dev' for regex 'ruby2.4*'
Note, selecting 'ruby2.3-doc' for regex 'ruby2.4*'
Note, selecting 'libruby2.3' for regex 'ruby2.4*'
Note, selecting 'ruby-ruby2ruby' for regex 'ruby2.4*'
Note, selecting 'ruby2.3-tcltk' for regex 'ruby2.4*'
libruby2.3 is already the newest version (2.3.3-1ubuntu1).
ruby2.3 is already the newest version (2.3.3-1ubuntu1).
ruby2.3-dev is already the newest version (2.3.3-1ubuntu1).
ruby2.3-dev set to manually installed.
The following additional packages will be installed:
libmatheval1 ruby-parser ruby-sexp-processor uwsgi-core
Suggested packages:
nginx-full | cherokee | libapache2-mod-proxy-uwsgi | libapache2-mod-uwsgi | libapache2-mod-ruwsgi uwsgi-plugins-all uwsgi-extra
The following NEW packages will be installed
libmatheval1 ruby-parser ruby-ruby2ruby ruby-sexp-processor ruby2.3-doc ruby2.3-tcltk uwsgi-core uwsgi-plugin-rack-ruby2.3
0 to upgrade, 8 to newly install, 0 to remove and 44 not to upgrade.
Need to get 4,444 kB of archives.
After this operation, 34.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

谢谢。

最佳答案

只需添加我们的存储库,如果您还没有:

$ sudo apt-add-repository ppa:brightbox/ruby-ng

$ sudo apt-get update

安装包:

$ sudo apt-get install ruby2.4 ruby2.4-dev

你已经启动并运行了:

$ ruby2.4 -v

ruby 2.4.0p0(2016-12-24 修订版 57164)[x86_64-linux-gnu]

关于ruby - 在 (K)Ubuntu 17.10 上安装 ruby​​ 2.4 的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47037665/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com