如何修复错误:无法在rbenv安装上下载

时间:2017-05-15 09:33:41

标签: curl rbenv

新的,新的CentOS 7.0 VM Rbenv安装不会为我安装红宝石

[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)

问题似乎源于curl,例如

[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 ~]$

2 个答案:

答案 0 :(得分:19)

您失败的原因:

当您访问某个网址时,某些旧的/易受攻击的NSS会在cURL库中用于SSL,因此会被拒绝。因此,在这台机器中,您可能无法运行与cURL相关的命令,例如pycurl。

解决方案:

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

yum update nss nss-util nspr

希望这有帮助!

答案 1 :(得分:5)

在我的情况下,更新docker run -v /home/<host user>/.ssh:/home/<docker user>/.ssh <image> 并结合nss更新帮助。