vps – Unable to connect to PostgreSQL 9.1 on Ubuntu 12.04 (64 bit) – Server Fault
I want to deploy my Rails application on an Ubuntu VPS with nginx & PostgreSQL but I can’t seem to get PostgreSQL to connect.
What I did:
1) Update apt-get
2) Install required tools
apt-get install curl git-core python-software-properties
3) Add nginx ppa to apt-get, update apt-get again and install nginx
4) Start nginx, check on nginx whether it works (it works)
5) Install PostgreSQL (version 9.1.3 got installed)
apt-get install postgresql libpq-dev
When I tried to connect through the below methods, it failed:
psql -U postgres psql -U postgres -h localhost psql -U postgres -h localhost -p 5432
What I have tried so far:
- Config file is located in /usr/share/postgresql/9.1/postgresql.conf.sample. I have tried renaming it without “.sample” and restarted the server. Still, failed.
- Adding the ppa:pitti/postgresql to apt-get and installing it, 9.1 still got installed
- Giving 0777 permissions on postgresql.conf (ref to number 1 to know which file I am talking about)
- Editing the postgresql.conf
Content of the conf file:
psql: could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?