Psql server start


I have Fedora-31 Template. And a VM based on this template.

I installed PSQL in Template:

$ sudo dnf install postgresql postgresql-server

If I try to connect to PSQL from my VM using Python, I get the following error:

conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host “” and accepting
TCP/IP connections on port 5432?

If I type “$ postgres --version” in my VM, I get “postgres (PostgreSQL) 11.8”, so I think it is installed properly.

How to debug it?

There are some pretty specific questions there. Have you tried to
answer them?
(Hint - You can use netstat -lntp to show listening ports and associated
programs, or better, `ss -tunlp``)

Have you actually started the server?

There’s nothing Qubes specific here. Don’t forget that many problems
can be solved by looking at standard distro instructions.
The only Qubes specific thing here will be storing the database data in
a persistent place - and for that purpose remember that /rw/usrlocal
is mounted at /usr/local, and so persists across AppVM reboots.


Thank you for you answer. The problem has narrowed down to starting the server.

The psql documentation says to start the server using the following code:
$ postgres -D /usr/local/pgsql/data

But this folder does not exist in VM, also not in Template. How to proceed?


1 Like