Install Postgres on WSL 2 (Ubuntu):

sudo apt update
sudo apt install postgresql
psql --version

If the version of Postgres that corresponds to your Ubuntu is not what you want, you can use the PostgreSQL Apt Repository. It will provide automatic updates for all supported versions of Postgres.

# Automated repository configuration
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
 
# Install again
sudo apt install postgresql
psql --version

References