如何使用apt安装指定版本的Ruby [英] How to install version specified Ruby using apt
问题描述
我尝试安装指定版本为 2.5.1 的 Ruby(该版本只是示例),并尝试执行以下脚本,但出现如下错误.是否可以使用 apt 安装版本来安装 Ruby 以便我可以处理 Ruby 版本依赖问题?
I tried to install Ruby with version specified 2.5.1 (the version is just example), and tried following script, but I got an error as follows. Is it possible to install Ruby with a version using apt installing so I can deal with Ruby version dependency issue?
$ sudo apt update ; sudo apt install ruby-full=2.5.1
Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Get:2 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://ppa.launchpad.net/kelleyk/emacs/ubuntu bionic InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:6 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:7 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:8 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Hit:9 http://ppa.launchpad.net/teejee2008/timeshift/ubuntu bionic InRelease
Fetched 64.4 kB in 2s (41.9 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
40 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '2.5.1' for 'ruby-full' was not found
推荐答案
您要安装的特定 ruby 版本必须是 Ubuntu 发行版的软件包存储库中可用的软件包.一种快速检查方法是使用 apt list |grep ruby-full
或 apt 列表 |grep ruby
.
The specific version of ruby you want to install has to be a package available in your Ubuntu distro's package repository. A quick way to check this is using apt list | grep ruby-full
or apt list | grep ruby
.
如果没有找到您要找的版本,您可以添加一个存储库并从那里下载.Brightbox 是一个广泛使用的存储库,维护着多个 ruby 版本的包.他们的安装文档应该对您有所帮助.
If you don't find the version you're looking for, you can add a repository and download it from there. Brightbox is a widely used repository maintaining several ruby version packages. Their installation docs should help you.
注意:我仍然建议您使用 ruby 版本管理器,例如 rbenv
或 rvm
.
Note: I still recommend that you use a ruby version manager like rbenv
or rvm
.
这篇关于如何使用apt安装指定版本的Ruby的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!