使用RVM安装Ruby 1.9.2时发生curl证书错误

尝试下载Ruby 1.9.2时,RVM遇到证书错误。 它看起来像curl是有证书问题,但我不知道如何绕过它。 我已经包括下面的确切的错误信息。

 $ rvm install 1.9.2 Installing Ruby from source to: /Users/willdennis/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)... ruby-1.9.2-p180 - #fetching ERROR: Error running 'bunzip2 '/Users/willdennis/.rvm/archives/ruby-1.9.2-p180.tar.bz2'', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/extract.log ruby-1.9.2-p180 - #extracting ruby-1.9.2-p180 to /Users/willdennis/.rvm/src/ruby-1.9.2-p180 ruby-1.9.2-p180 - #extracted to /Users/willdennis/.rvm/src/ruby-1.9.2-p180 Fetching yaml-0.1.3.tar.gz to /Users/willdennis/.rvm/archives curl: (60) SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed More details here: http://curl.haxx.se/docs/sslcerts.html curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). The default bundle is named curl-ca-bundle.crt; you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. ERROR: There was an error, please check /Users/willdennis/.rvm/log/ruby-1.9.2-p180/*.log. Next we'll try to fetch via http. Trying http:// URL instead. curl: (60) SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed More details here: http://curl.haxx.se/docs/sslcerts.html curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). The default bundle is named curl-ca-bundle.crt; you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. ERROR: There was an error, please check /Users/willdennis/.rvm/log/ruby-1.9.2-p180/*.log Extracting yaml-0.1.3.tar.gz to /Users/willdennis/.rvm/src ERROR: Error running 'tar zxf /Users/willdennis/.rvm/archives/yaml-0.1.3.tar.gz -C /Users/willdennis/.rvm/src --no-same-owner', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/extract.log /Users/willdennis/.rvm/scripts/functions/packages: line 55: cd: /Users/willdennis/.rvm/src/yaml-0.1.3: No such file or directory Configuring yaml in /Users/willdennis/.rvm/src/yaml-0.1.3. ERROR: Error running ' ./configure --prefix="/Users/willdennis/.rvm/usr" ', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/configure.log Compiling yaml in /Users/willdennis/.rvm/src/yaml-0.1.3. ERROR: Error running '/usr/bin/make ', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/make.log Installing yaml to /Users/willdennis/.rvm/usr ERROR: Error running '/usr/bin/make install', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/make.install.log ruby-1.9.2-p180 - #configuring ERROR: Error running ' ./configure --prefix=/Users/willdennis/.rvm/rubies/ruby-1.9.2-p180 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/willdennis/.rvm/usr ', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/configure.log ERROR: There has been an error while running configure. Halting the installation. 

我该如何解决或避免这个错误?

如果有其他人遇到这种情况,而试图更新到1.9.3(尽pipe版本可能并不重要),检查你有的rvm的版本。 韦恩似乎已经从rvm.beginrescueend.com移到rvm.io. 旧网站的安全证书已经过期,所以curl的回复是正确的。

从新的网站更新rvm解决了这个问题,并允许我前进。

 $ \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled 

更新 :作为@rodgerdpack提到,命令更改,我已经更新上述。 一般来说,请参阅https://rvm.io/了解最新信息。;

如果不想更改脚本 ,并且您不希望将证书“永远”添加到证书包中。 有一个非常好的和快速的解决scheme:

 #to download the cert wget http://curl.haxx.se/ca/cacert.pem #to let curl use it for the next calls export CURL_CA_BUNDLE=~/cacert.pem 

然后运行你的脚本。 要重置环境variables(对于不应该使用此证书的后续脚本调用),请重新login到系统或取消设置环境variables:

 export CURL_CA_BUNDLE= 

curl是在.rvm / scripts / fetch中调用的,默认情况下会在你的主目录下。

使用你最喜欢的文本编辑器来编辑它:例如,

  nano ~/.rvm/scripts/fetch 

在第56行和第58行(当然,可能与其他版本的RVM有所不同),你会看到两行开始

  fetch_command="curl ... 

只需在curl后添加-k,保存并重试。

您需要从http://curl.haxx.se/ca/cacert.pem下载ca证书,并将它们添加到curl-ca-bundle-new.crt文件中。;

要find这个文件的位置使用:

  $ curl-config --ca /usr/share/curl/curl-ca-bundle.crt 

备份你的curl-ca-bundle.crt文件:

 $ cp /usr/share/curl/curl-ca-bundle.crt /usr/share/curl/curl-ca-bundle.crt.old 

然后你想连接这两个文件使用:

 $ cat cacert.pem /usr/share/curl/curl-ca-bundle.crt >> curl-ca-bundle-new.crt 

也许所有这些复杂的解决scheme都曾经是必要的,但现在您只需要升级RVM就可以解决问题了:

 $ rvm get stable $ rvm reload $ rvm install ruby-1.9.3-p194 

如果您不介意禁用curl证书检查(我不):

 echo insecure > ~/.curlrc 

在Centos 5.6(最终)我有一个问题,安装rvm 1.9.2错误是:

 curl: (60) SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed More details here: http://curl.haxx.se/docs/sslcerts.html curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). The default bundle is named curl-ca-bundle.crt; you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. ERROR: There was an error, please check /usr/local/rvm/log/ruby-1.9.2-p290/*.log. Next we'll try to fetch via http. Trying http:// URL instead. curl: (60) SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed More details here: http://curl.haxx.se/docs/sslcerts.html curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). The default bundle is named curl-ca-bundle.crt; you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. ERROR: There was an error, please check /usr/local/rvm/log/ruby-1.9.2-p290/*.log ERROR: There has been an error while trying to fetch the source. Halting the installation. ERROR: There has been an error fetching the ruby interpreter. Halting the installation. 

以下是帮助我解决问题的一系列行动

 $ curl-config --ca # show path to the certificate /usr/local/share/curl/curl-ca-bundle.crt $ cd /usr/local/share/curl/ # go to that path $ cp curl-ca-bundle.crt curl-ca-bundle.crt.bak # backup certificate $ curl http://curl.haxx.se/ca/cacert.pem -o curl-ca-bundle.crt # download new $ rvm install 1.9.2 # bingo it works 

顺便说一下,curl版本是curl7.18.0(检查'$curl-V')

我试图安装ruby-1.9.2-p290 ,遇到同样的问题。 在运行which curl ,我意识到curl实例来自我的系统(OS X Snow Leopard)上的MAMP安装,我重新configuration了我的PATHvariables以使用/usr/bin/curl的系统默认值。 使用这个版本, curl 7.19.7 ,我没有问题安装与RVM的最新版本的Ruby。

我无法安装使用RVM 1.9.2,这里是我的解决scheme:

我仍然没有find文件错误,但安装继续成功

[2011-07-05 14:24:07] tar zxf /Users//.rvm/archives/yaml-0.1.3.tar.gz -C /Users//.rvm/src –no-same-owner tar (子):/Users//.rvm/archives/yaml-0.1.3.tar.gz:无法打开:没有这样的文件或目录tar(child):错误不可恢复:现在退出tar:子项返回状态2 tar :错误退出从以前的错误延迟

谢谢多萝西 – 这个配方为我工作,对Win7环境进行了以下小修改:

对于这个问题的其他人 –

  1. 感谢有关更新CA_Bundle的讨论 – 很好但是这并没有帮助解决这个问题 – pyyaml网站证书仍然会导致CURL抛出一个错误,因为CURL在安装程序中启动,无法添加-k选项。

  2. Ruby 1.9.2-p290正在尝试安装YAML 0.1.4,所以Google用于镜像并下载该版本–YAML-0.1.3将不会绕过这些问题。

  3. 您需要在解压缩文件的rvm / src文件夹中执行相当于CHMOD 777的窗口。 更改安全性,以便每个人拥有所有权/所有权限,并closures所有文件和文件夹的只读属性。

当它尝试下载(CURL错误)时,安装程​​序仍然会抛出错误,但是会通过尝试提取来继续。 提取会抛出错误,因为压缩包已经提取到src文件夹。 如果步骤3中的权限设置正确并且安装应该没有进一步问题,那么configurationYAML的下一步应该没有错误地工作。 (如果通过cygwin / bash安装,你将需要添加一个像'gcc'这样的C编译器,并在默认的核心cygwin安装选项中添加'ncurses'(tput命令)和'make'。

 $ sudo apt-get install curl $ curl -L https://get.rvm.io | bash -s stable --ruby with ruby $ curl -L https://get.rvm.io | bash -s stable --rails with rails