Ubuntu 14.04でrailsでPostgreSQLを使おうと
まずpostgresqlをインストール
$ sudo apt-get install postgres
パスワードつけて
$ sudo passwd postgres
$ sudo -u postgres psql -c “ALTER USER postgres PASSWORD ‘postgres’;”
Gemを入れるため
$ vim Gemfile
gem ‘pg’
を追記
インストールでエラー発生
$ bundler install -j4
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/vagrant/.rbenv/versions/2.2.0/bin/ruby -r ./siteconf20141227-1584-lh6tpc.rb extconf.rb
checking for pg_config… yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
checking for libpq-fe.h… no
Can’t find the ‘libpq-fe.h header
*** 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.
これで直りました
$ sudo apt-get install postgresql-server-dev-9.3