Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am getting this error with Postgresql 8.4 on Ubuntu Hardy:

$./postgres -D /usr/local/pgsql/data
LOG:  could not bind IPv4 socket: Cannot assign requested address
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets

Here is my hosts file content (been finding a lot of stuff about this so just posting it now:

127.0.0.1 localhost
127.0.1.1 Home-Dev

Update: $ sudo netstat -tap | grep 5432 Came up blank.

I should also mention this is installed from source (I had original tried to install from the package and was getting the same error).

share|improve this question

3 Answers 3

sudo /etc/init.d/postgres start

If you installed postgres via the package manager try that.

If it fails again, please post the contents of: sudo netstat -tap | grep 5432

share|improve this answer
    
It's actually /etc/init.d/postgresql-8.4. –  Peter Eisentraut Dec 25 '10 at 5:46

I had no loopback interface installed. When I installed it postgres started working.

share|improve this answer

Assuming that 127.0.1.1 is the IPv4 address of this machine that you are working on, I would like to point you to the following configuration files to look at: (the directory/pathnames may vary with relevance to your installation). You may find them in /etc/postgresql/8.4/main/ (found here in Ubuntu 10.04)

  • pg_hba.conf (/var/lib/pgsql/data/pg_hba.conf)
    • Comment out the other parameters and drop in the following
      • local all all trust
      • host all all 127.0.0.1/32 trust
      • host all all ::1/128 trust
      • host all all 127.0.1.1 255.255.255.255 trust
  • postgresql.conf (/var/lib/pgsql/data/postgresql.conf)
    • Ensure that the following parameter is pegged with a wildcard value
      • listen_address = '*'
    • Ensure that the following parameter is uncommented
      • port = 5432

You may want to amend/modify the values in the future once you have your PostgreSQL service up and running. :-) Hope this will be helpful.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.