Reputation: 131
I have been trying to set up my ruby on rails dev environment for a project I just started working on. I have installed Ruby 1.9.3, Rails 3.2, and postgresql 9.1.4 on Ubuntu 12, and when I try rake db:create:all I get the message:
/var/lib/gems/1.9.1/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:1194:in `initialize': could not connect to server: No such file or directory (NameError)
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I then added:
host: localhost
port: 5432
to my database.yml file, which let me do db:create:all and db:migrate, but when I run the rails server locally it still has the same error.
I have checked that the postgresql server is running, which it is (I also know it is running since rake worked earlier), and have tried a fresh install of postgresql. What might I be missing to make this work?
Upvotes: 4
Views: 1526
Reputation: 4455
Are you sure your postgres server is running?
If you do ps -aef|grep postgres
, you should see something like this:
[root@haddock ~]# ps -aef|grep 'postgres'
postgres 5963 5475 0 21:28 ? 00:00:00 /usr/postgresql/bin/postmaster -D <your postgres directory>
postgres 5972 5963 0 21:28 ? 00:00:00 postgres: writer process
postgres 5973 5963 0 21:28 ? 00:00:00 postgres: wal writer process
postgres 5974 5963 0 21:28 ? 00:00:00 postgres: autovacuum launcher process
postgres 5975 5963 0 21:28 ? 00:00:00 postgres: stats collector process
admin 6750 6607 0 21:30 ttyS0 00:00:00 grep postgres
Upvotes: 2