简体   繁体   English

使用 rbenv 下载的文件安装 ruby

[英]Install ruby using rbenv's downloaded file

I need to install ruby 2.0.0-p645 and I use rbenv .我需要安装ruby 2.0.0-p645并使用rbenv I tried downloading it by running我尝试通过运行下载它

rbenv install 2.0.0-p645

But the internet in my college keeps dropping every few minutes, so the transfer was always closing with some 11MB remaining.但是我大学里的互联网每隔几分钟就会掉线,所以传输总是在剩下大约 11MB 的情况下结束。

To counter that, I saw the url from where rbenv was downloading, and used wget to download the source file that rbenv was downloading.为了解决这个问题,我看到了rbenv正在下载的 url,并使用wget下载了rbenv正在下载的源文件。 (using wget -c for resuming every time the connection closed). (每次连接关闭时使用wget -c恢复)。

Now I have the file, is there a way to install that ruby version now?现在我有了这个文件,现在有没有办法安装那个 ruby​​ 版本?

The file's link on cloudfront that I have on my machine.我的机器上的 cloudfront文件链接

Yes.是的。 Put the downloaded file into ~/.rbenv/cache .将下载的文件放入~/.rbenv/cache You might need to create the directory first.您可能需要先创建目录。 Then run your rbenv install command again.然后再次运行您的rbenv install命令。 Here is the link to the documentation for this: https://github.com/rbenv/ruby-build#package-download-caching这是文档的链接: https : //github.com/rbenv/ruby-build#package-download-caching


To summarize, for future reference:总结一下,以供将来参考:

  1. Download the file using wget使用wget下载文件
  2. Create a cache folder in ~/.rbenv/ if it doesn't exist already.如果它不存在,则在~/.rbenv/创建一个cache文件夹。
  3. Rename the downloaded file to ruby-xyz-pabc.tar.gz .将下载的文件重命名为ruby-xyz-pabc.tar.gz Extract it and move it to ~/.rbenv/cache/解压并移动到~/.rbenv/cache/
  4. Run rbenv install xyz-pabc运行rbenv install xyz-pabc

For me, the following steps work.对我来说,以下步骤有效。

1 Download the file using `wget/curl or any other way`
2. Create a `cache` folder in `~/.rbenv/` if it doesn't exist already.
3. Move the downloaded file to `~/.rbenv/cache/`
4. Run `rbenv install x.y.z` (ex. rbenv install 2.7.1`)

The difference from the above answer was,与上述答案的不同之处在于,

- do not need to change file name 
- do not need to extract 
- if file rename to something random (ex. x.y.z-pabc) it show ruby-build: definition not found: x.y.z-pabc

Hope this can help someone.希望这可以帮助某人。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM