問題の概要
①Amazon LinuxでPostgreSQLインストール後、bundle installしたら、pqエラーが発生
②下記のQiita記事を参考に、コマンドを入力したが、解決出来ず。
$ sudo yum install postgresql-devel
参考URL:libpq-fe.h が見つけられない。
③発生したエラーは以下の通り
$ bundle install --path vendor/bundle
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
An error occurred while installing pg (1.1.3), and Bundler cannot
continue.
Make sure that `gem install pg -v '1.1.3' --source 'https://rubygems.org/'`
succeeds before bundling.
解決法
下記のサイトで同様の質問があり、回答通りに解決方法を試したら、無事に動作しました。
https://forums.aws.amazon.com/thread.jspa?threadID=268964
$ sudo yum install postgresql96 postgresql96-server postgresql96-libs postgresql96-contrib postgresql96-devel
最後に
同じような問題に悩んでいる方に役立てられればと思い、今回の記事に纏めました。