インストール
bz2はlibbz2をRubyから扱うためのライブラリです。bz2をインストールするには、あらかじめbzip2-develパッケージをインストールしておく必要があります。
$ sudo yum install bzip2-devel $ sudo gem install bz2 --no-ri --no-rdoc
bzip2-develパッケージがインストールされていないと、次のようなメッセージを表示してbz2のインストールに失敗します。
$ sudo gem install bz2 --no-ri --no-rdoc Building native extensions. This could take a while... ERROR: Error installing bz2: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb checking for BZ2_bzWriteOpen() in -lbz2... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. (中略) extconf.rb:18: libz2 not found (RuntimeError) Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/bz2-0.2.2 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/bz2-0.2.2/ext/bz2/gem_make.out