How to get started with Postgresql on Ubuntu 20.04
-
17-03-2021 - |
Question
I've tried several online posts that say they'll get me started with Postgres on Ubuntu. I have failed (or they have failed me) on all of them.
My first attempt was with https://www.digitalocean.com/community/tutorials/how-to-install-postgresql-on-ubuntu-20-04-quickstart
It used an added repository, but I like using the Ubuntu packages, so I started with (and captured all output) a few more initial loads:
apt-get --quiet --assume-yes install postgresql postgresql-doc postgresql-contrib python3-psycopg2 python-psycopg2-doc
But right after loading, the article says
$ sudo -i -u postgres
the results of which were
sudo: unknown user: postgres
sudo: unable to initialize policy plugin
So I figured the article was for Digital Ocean, whatever that is, and I tried something else
It starts with installing a client, but not having a server yet, I jumped down to that part, and it says right after installing, I should see postgres listening on 127.0.0.1:5432 with the output of
ss -slt
but I don't see that at all. I get
Total: 656 TCP: 14 (estab 1, closed 3, orphaned 0, timewait 1)
Transport Total IP IPv6 RAW 1 0 1
UDP 14 8 6 TCP 11 8 3
INET 26 16 10 FRAG 0 0 0
State Recv-Q Send-Q Local Address:Port
Peer Address:Port Process LISTEN 0 128
0.0.0.0:36330 0.0.0.0:* LISTEN 0 151 127.0.0.1:mysql
0.0.0.0:* LISTEN 0 4096 127.0.0.53%lo:domain 0.0.0.0:* LISTEN 0 128 0.0.0.0:ssh
0.0.0.0:* LISTEN 0 5 127.0.0.1:ipp 0.0.0.0:* LISTEN 0 128 0.0.0.0:7396
0.0.0.0:* LISTEN 0 Total: 656 TCP: 14 (estab 1, closed 3, orphaned 0, timewait 1)
Transport Total IP IPv6 RAW 1 0 1
UDP 14 8 6 TCP 11 8 3
INET 26 16 10 FRAG 0 0 0
State Recv-Q Send-Q Local Address:Port
Peer Address:Port Process LISTEN 0 128
0.0.0.0:36330 0.0.0.0:* LISTEN 0 151 127.0.0.1:mysql
0.0.0.0:* LISTEN 0 4096 127.0.0.53%lo:domain 0.0.0.0:* LISTEN 0 128 0.0.0.0:ssh
0.0.0.0:* LISTEN 0 5 127.0.0.1:ipp 0.0.0.0:* LISTEN 0 128 0.0.0.0:7396
0.0.0.0:* LISTEN 0 70 127.0.0.1:33060 0.0.0.0:* LISTEN 0 511 *:http
*:* LISTEN 0 128 [::]:ssh [::]:* LISTEN
0 5 [::1]:ipp
[::]:* 70 127.0.0.1:33060
0.0.0.0:* LISTEN 0 511 *:http *:* LISTEN 0 128 [::]:ssh
[::]:* LISTEN 0 5
[::1]:ipp [::]:*
So I'm getting nowhere. I can verify that the system thinks it has postgres, but I can't get it to do anything at all.
No correct solution