rubyのインストール | ぽにょ、ぽにょぽーにょ

ぽにょ、ぽにょぽーにょ

2012年からWebエンジニア。
プログラムとか、趣味とか、人生とかの備忘録。

なんかアメブロってださくて使いづらいからそのうち引っ越しまふ。

あらかじめ必要なものをダウンロード
# yum install gcc zlib-devel openssl-devel

・ルビーを本家からダウンロード
https://www.ruby-lang.org/ja/

[install]
・cd /tmp/ruby-2.1.1
  ./configure
  .make test
  .make install

[gemの確認]
・gem update --system

ERROR:  Loading command: update (LoadError)
        cannot load such file -- zlib
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

zlibがないので、入れる

・cd /tmp/ruby-2.1.1/ext/zlib
  ruby extconf.rb

# ruby extconf.rb
checking for deflateReset() in -lz... no
checking for deflateReset() in -llibz... no
checking for deflateReset() in -lzlib1... no
checking for deflateReset() in -lzlib... no
checking for deflateReset() in -lzdll... no
checking for deflateReset() in -lzlibwapi... no

↑これが出たとき
 yum install gcc zlib-devel openssl-develを確認
# make clean
# ruby extconf.rb
checking for deflateReset() in -lz... yes
checking for zlib.h... yes
checking for crc32_combine() in zlib.h... yes
checking for adler32_combine() in zlib.h... yes
checking for z_crc_t in zlib.h... no
creating Makefile

#make install

終わったら、、
# gem update --system
ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

#cd /tmp/ruby-2.1.1/ext/openssl
#ruby extconf.rb
#make install

[error]
make: *** No rule to make target `/thread_native.h', needed by `ossl.o'.  Stop.
(参考)
http://stackoverflow.com/questions/21498868/install-openssl-support-for-selfcompiled-ruby-installation

# find / -name thread_native.h
/tmp/ruby-2.1.1/thread_native.h

# vim Makefile

 topdir = /usr/local/include/ruby-2.1.0
⇒追加 top_srcdir = /tmp/ruby-2.1.1

# gem update --system
エラーがないことを確認