Rails: Error installing pg gem
Steps to install postgresql
Install PostgreSQL and its libraries
sudo apt-get install postgresql postgresql-contrib libpq-dev
After the installation create a user for postgresql
sudo -u postgres createuser --superuser $USER
or
sudo -u postgres createuser pgs_root
Set user password for the postgresql user
sudo -u postgres psql postgres --set "user=$USER" postgres=# \passsword :user
or
sudo -u postgres psql postgres postgres=# \passsword pgs_root
Configure the postgresql.conf file to make PostgreSQL listen to localhost or listen on an external IP or something, change this line to either the IP or 'localhost'
gedit /etc/postgresql/8.4/main/postgresql.conf listen_addresses = 'localhost'
Like mysql query browser, there is a GUI for postgresql called pgadmin. To install run this command
sudo apt-get install pgadmin3
Are you on a Mac? If so - the easiest way to do this is to
- make sure you have Xcode installed (you can get it from the app store)
- use Homebrew
brew install postgresql
gem uninstall pg
- either
bundle install
in your application's root orgem install pg
Try to include this instead of pg
gem install postgres-pr
or
gem install ruby-pg
Edit
Did you do this already?
$ sudo apt-get install postgresql
$ rails new pg -d postgres
http://www.funonrails.com/2011/03/getting-started-with-rails-3-postgres.html