Here is what I ran, worked on 2024-05-27:
sudo apt update
sudo apt install postgresql
sudo service postgresql start
sudo visudo
add following line to end of file:
codespace ALL=(ALL) NOPASSWD: /usr/bin/psql
then run
sudo -u postgres psql postgres
type \password postgres
and set a password (for username postgres)