How to set PostgreSQL password after installation

sudo -u postgres psql
ALTER ROLE postgres WITH ENCRYPTED PASSWORD 'mypassword';