To create a Postgres user sam and a database samdb that is owned by the sam user:
$ su - postgres $ createuser -P -A -D sam $ createdb -O sam samdb
(Change the -A, and -D options to affect the new user's abilities.)
Edit the user's password with:
template1=# alter user username_here with password 'password_here';
accountcommandscreatedbcreateuserpermissionspostgresqluser