How to fix error: failed to download on rbenv install

How to fix error: failed to download on rbenv install

在全新的 CentOS 7.0 VM Rbenv 安装中不会为我安装 rubies

[vagrant@ad-proxy ~]$ rbenv install 2.2.4
Downloading ruby-2.2.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
error: failed to download ruby-2.2.4.tar.bz2

BUILD FAILED (CentOS Linux 7 using ruby-build 20170405-4-g365dd1f)

它显示了更详细的日志记录

[vagrant@ad-proxy ~]$ rbenv install 2.2.4 -v
/tmp/ruby-build.20170515092651.20803 ~
Downloading ruby-2.2.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
curl: (35) Peer reports incompatible or unsupported protocol version.
error: failed to download ruby-2.2.4.tar.bz2

BUILD FAILED (CentOS Linux 7 using ruby-build 20170405-4-g365dd1f)

这个问题似乎起源于卷曲,例如

[vagrant@ad-proxy ~]$ curl https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
curl: (35) Peer reports incompatible or unsupported protocol version.
[vagrant@ad-proxy ~]$ curl https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2 -v
* About to connect() to cache.ruby-lang.org port 443 (#0)
*   Trying 151.101.36.233...
* Connected to cache.ruby-lang.org (151.101.36.233) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* NSS error -12190 (SSL_ERROR_PROTOCOL_VERSION_ALERT)
* Peer reports incompatible or unsupported protocol version.
* Closing connection 0
curl: (35) Peer reports incompatible or unsupported protocol version.
[vagrant@ad-proxy ~]$

失败原因:

一些 old/vulnerable 当你去一些 url 时,NSS 在 cURL 库中用于 SSL,所以它被拒绝了。因此,在这台机器中,您有机会无法执行 运行 cURL 相关命令,例如 pycurl.

解决方法:

IMO NSS 与 CentOS 7.0 VM 捆绑在一起,因此您可以按以下方式更新 NSS 库。

yum update nss nss-util nspr

希望对您有所帮助!

就我而言,更新 curl 结合 nss 更新很有帮助。