Skip to content

Instantly share code, notes, and snippets.

@m-mujica
Last active December 31, 2019 14:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-mujica/5695856 to your computer and use it in GitHub Desktop.
Save m-mujica/5695856 to your computer and use it in GitHub Desktop.
Set up PostgreSQL for Rails Local Development in Linux

Original Instructions

http://pragtob.wordpress.com/2012/09/12/setting-up-postgresql-for-ruby-on-rails-on-linux/

sudo apt-get install postgresql

tobi@speedy ~ $ sudo su postgres
[sudo] password for tobi:
postgres@speedy /home/tobi $ createuser tobi(substitute with your username)
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n

Database.yml

development:
  adapter: postgresql
  database: ArbitaryDatabaseName
  pool: 5
  timeout: 5000

Troubleshooting.

psql: fe_sendauth: no password supplied

  • Edit /etc/postgresql/9.1/main/pg_hba.conf and set authentication method to Trust
local   all             all                                     trust
host    all             all             127.0.0.1/32            trust
host    all             all             ::1/128                 trust
  • Restart PostgreSQL
sudo /etc/init.d/postgresql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment