3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RedHatでgem時にzlib ERRORが発生する

Posted at

RedHat7.1の環境でgem installしようと思ったらzlib周りでトラブルがあったのでTipsです。

##発生したエラー

ERROR: Loading command: install (LoadError) cannot load such file -- zlib ERROR: While executing gem ...(NameError) uninitialized constant Gem::Commands::InstallCommand

##事前にやっておくこと

yum -y remove ruby

RedHat公式のRubyではzlibがリンクされていないようなので、削除しておきます。

##導入手順

###zlib導入

yum -y install gcc zlib zlib-devel

※opensslエラーもあった場合はyum -y install gcc zlib zlib-devel openssl openssl-develとなります

###rubyインストール

Rubyページより最新版のパスを取得

cd /usr/local/src
wget (パスを貼り付け)
tar xvfz ruby-*.tar.gz

Rubyからzlibを使えるように

cd ruby*/ext/zlib
ruby extconf.rb

cd /usr/local/src/ruby*
./configure
make; make install

###バージョン確認

ruby -v

###gem導入

yum -y install gem

これでgemが使えるようになりました!

##参考にしたサイト

3
4
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
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?