On Ubuntu/Windows WSL 2 to install postgres you have to use apt package manager:

sudo apt install postgresql

Start server:

sudo service postgresql start

Change password for user postgres

sudo passwd postgres
# New password: 
# Retype new password: 
# passwd: password updated successfully

Run PostgreSQL client (psql) with user postgres privileges:

su -c psql postgres

It will ask password, enter the password you defined above.

You can always change password again if you forgot it

Create database

To create a database with name testdb type:

CREATE DATABASE testdb ENCODING 'utf-8';

Create a user for Database

CREATE USER myuser with encrypted password 'passw1';
GRANT ALL PRIVILEGES ON database testdb to myuser;
\c testdb
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO myuser; -- don't change public
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public to myuser;
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public to myuser;

Create postgres database