Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After the successful import of the ssh keypairs, the bootstrap generates this error.

Can anyone help me?

connection_factory=connection_factory, async=async)
psycopg2.OperationalError: could not connect to server: Connection refused
    Is the server running on host "localhost" ( and accepting
    TCP/IP connections on port 5432?

I have tried:

  • Ensuring PostgreSQL is installed and running via: 'sudo service postgresql start`

This errors appears how i running 'sudo apt-get update'.

share|improve this question
What program are you referring to? – Manuel Sep 11 '13 at 6:08
In trying install maas as a service. I'm newbie! This occurs. I believe my proxy or other config is generate this error or my network config. – Sidiney Rodrigues Sep 13 '13 at 21:33
up vote 1 down vote accepted

It looks like postgres is not running or not installed.


sudo service postgresql start
share|improve this answer
Hi, thanks, but continuous get the same error. – Sidiney Rodrigues Sep 11 '13 at 17:28
The error get in the if i apply Updates. Maybe my configuration port are broken or config with error. It's various days I seek help, and don't understand whats happening with the ssh key. – Sidiney Rodrigues Sep 11 '13 at 17:41
@SidineyRodrigues Can you add anymore information to your question? Also please click the green check on this answer to mark it as unanswered, that way it can get more attention, thanks! – Jorge Castro Sep 11 '13 at 20:10
Thank You. For this. The error continue. – Sidiney Rodrigues Sep 12 '13 at 1:32

If the server is running and you still get the error, you must configure Postgres to accept connections from other IPs. In order to do so, locate the postgresql.conf file.

Look for listen_addresses property and replace localhost with the choice of your IPs separated by comma OR * to accept connections from any IP.

Restart the postgresql server. You should be good. :)

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.