Debian PostgreSQL doesn't appear to be working

I've just set up a server running Debian 6.0 64-bit. I've installed PostgreSQL through aptitude, and now i try to access PostgreSQL without any luck. I am trying to access psql as the user postgres, but get this error message

psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

I can't seem to find the folder where all the config files is either. On my CentOS server the config files are stored in /var/lib/pgsql, on my Debian server there is a folder called postgresqlin /var/lib but it's empty.


If /var/lib/postgresql/ is empty, something is wrong. It should have a directory for each version of PostgreSQL that you have installed, assuming you did the installation through the normal dpkg/apt-get processes (which you say you did) and that the package was intended for Debian. On the other hand, you have the postgres user and the psql command available. It is certainly possible that you have one of the postgresql-client-* packages installed but not the server package.

Since you pretty clearly do not have PostgreSQL successfully running, I would suggest a purge and reinstall through aptitude, or (as root):

apt-get purge postgresql-8.4
apt-get install postgresql-8.4

One final note. PostgreSQL has its own APT repository, so if you want to use a newer version than 8.4, you can do so with little hassle. To use it, as root, add the following line to /etc/apt/sources.list:

deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main

Then, as root:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt-get update && apt-get install pgdg-keyring

You can then install versions 8.2, 8.3, 8.4, 9.0, 9.1, or 9.2, as of this writing. You can have multiple versions installed at once if you like. More information is available in the documentation to the postgresql-common package:

zless /usr/share/doc/postgresql-common/README.Debian.gz

Similar error occurs, if installation is not fully complete.Try setting default language , it is one of the common problem.

sudo apt-get remove postgresql* --purge
export LANGUAGE="en_GB.UTF-8"
export LC_ALL="en_GB.UTF-8"
sudo apt-get install postgresql