LoginSignup
3
0

More than 5 years have passed since last update.

CentOS6.7にruby2.4.3を入れようとしたらダウンロードでコケた

Last updated at Posted at 2018-01-16

環境

  • CentOS release 6.7 (Final)

やりたかったこと

  • rbenv を使って ruby2.4.3 を入れたかっただけです…

現象

rbenv 、rbenv-build のインストールは問題なく終了。
いざ rbenv を使って ruby をインストールしようとしたら、

$ rbenv install 2.4.3
Downloading ruby-2.4.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.3.tar.bz2
error: failed to download ruby-2.4.3.tar.bz2

BUILD FAILED (CentOS release 6.7 (Final) using ruby-build 20171226-3-g01e7b7b)

と言われてエラーΣ(´∀`;)
…なんでダウンロードでコケるの?ビルドでコケるならまだ分かるけど……。
https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.3.tar.bz2
をブラウザで叩いてみると、普通にダウンロードが始まるのでファイルは存在しているみたい。

ping yahoo.co.jp

してみても、普通に応答があるのでネットワークの問題でもないみたい。

解決策

よく分からないのでエラーログを見てみる。
場所は

$ pwd
/tmp

$ ls -la
合計 128
...
-rw-rw-r--   1 vagrant vagrant    67  1月 16 11:40 2018 ruby-build.20180116114029.4072.log
...

こんな感じのログファイルがあるので、中を見る。

ruby-build.20180116114029.4072
/tmp/ruby-build.20180116114029.4072 ~
curl: (35) SSL connect error

……SSL接続が出来てない??と思って検索したら、まさにドンピシャの記事を発見。
https://qiita.com/shunsuke_takahashi/items/a1c3655584530c76fbe0

要はCentOS6.7の libcurl が古くて SSL 接続でコケてる、と。
libcurlのバージョンを見てみると、

$ yum info libcurl
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
[city-fan.org]
 * epel: mirror01.idc.hinet.net
 * extras: ftp.riken.jp
 * remi-safe: mirrors.thzhost.com
 * updates: ftp.riken.jp
インストール済みパッケージ
名前                : libcurl
アーキテクチャ      : x86_64
バージョン          : 7.19.7
リリース            : 53.el6_9
容量                : 339 k
リポジトリー        : installed
提供元リポジトリー  : updates
要約                : A library for getting files from web servers
URL                 : http://curl.haxx.se/
ライセンス          : MIT
説明                : This package provides a way for applications to use FTP, HTTP, Gopher and
                    : other servers for getting files.

利用可能なパッケージ
名前                : libcurl
アーキテクチャ      : i686
バージョン          : 7.19.7
リリース            : 53.el6_9
容量                : 176 k
リポジトリー        : updates
要約                : A library for getting files from web servers
URL                 : http://curl.haxx.se/
ライセンス          : MIT
説明                : This package provides a way for applications to use FTP, HTTP, Gopher and
                    : other servers for getting files.

バージョンが7.19.7になってる。古いのかどうかよく分からない。
とりあえず記事通りに libcurl を最新にしました。
インストール後はこんな感じ↓

$ yum info libcurl
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * city-fan.org: www.city-fan.org
 * city-fan.org-debuginfo: www.city-fan.org
 * city-fan.org-source: www.city-fan.org
 * epel: mirror01.idc.hinet.net
 * extras: ftp.riken.jp
 * remi-safe: mirrors.thzhost.com
 * updates: ftp.riken.jp
インストール済みパッケージ
名前                : libcurl
アーキテクチャ      : x86_64
バージョン          : 7.57.0
リリース            : 1.0.cf.rhel6
容量                : 520 k
リポジトリー        : installed
提供元リポジトリー  : city-fan.org
要約                : A library for getting files from web servers
URL                 : https://curl.haxx.se/
ライセンス          : MIT
説明                : libcurl is a free and easy-to-use client-side URL transfer library, supporting
                    : FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, IMAP,
                    : SMTP, POP3 and RTSP. libcurl supports SSL certificates, HTTP POST, HTTP PUT,
                    : FTP uploading, HTTP form based upload, proxies, cookies, user+password
                    : authentication (Basic, Digest, NTLM, Negotiate, Kerberos4), file transfer
                    : resume, HTTP proxy tunneling and more.

利用可能なパッケージ
名前                : libcurl
アーキテクチャ      : i686
バージョン          : 7.57.0
リリース            : 1.0.cf.rhel6
容量                : 438 k
リポジトリー        : city-fan.org
要約                : A library for getting files from web servers
URL                 : https://curl.haxx.se/
ライセンス          : MIT
説明                : libcurl is a free and easy-to-use client-side URL transfer library, supporting
                    : FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, IMAP,
                    : SMTP, POP3 and RTSP. libcurl supports SSL certificates, HTTP POST, HTTP PUT,
                    : FTP uploading, HTTP form based upload, proxies, cookies, user+password
                    : authentication (Basic, Digest, NTLM, Negotiate, Kerberos4), file transfer
                    : resume, HTTP proxy tunneling and more.

おお、確かに、バージョンは新しくなってる。

これで

$ rbenv install 2.4.3
Downloading ruby-2.4.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.3.tar.bz2
Installing ruby-2.4.3...
Installed ruby-2.4.3 to /home/vagrant/.rbenv/versions/2.4.3

を叩いたら無事 ruby 入りました。
変な所に時間取られたよー…。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0