Show config file location with sudo -u postgres psql -c 'SHOW config_file'
Edit the file, default: sudo nano /etc/postgresql/14/main/postgresql.conf
listen_addresses = '*'
port = <remember-port>
sudo ufw allow <port>
Edit sudo nano /etc/postgresql/14/main/pg_hba.conf
# IPv4 local connections:
host all all 127.0.0.1/32 trust
sudo service postgresql restart
and
sudo ufw reload
Connect using pgAdmin as usual with 127.0.0.1 and the port.
This is very insecure, use only for local dev-environments.