Installation guide: https://gorails.com/setup/ubuntu/22.04.
Note: the guide above is only useful up until the part where you need to setup Postgres. We'll use another guide to install and setup Postgres.
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-22-04
https://stackoverflow.com/a/18664239/15065042. Your pg_hba.conf section talked about in the link above should look like: