Native Linux installation.

Figure 651. Installing Postgresql package Slide presentation
apt install postgresql-11  # Maybe newer?

Figure 652. Configuring Postgresql Slide presentation
useradd -r -s /usr/sbin/nologin hdmuser 

#> su - postgres -c "createuser --interactive"
Enter name of role to add: hdmuser
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n

su - postgres -c "PGPASSWORD=XYZ createdb --owner hdmuser hdm" 
alter role hdmuser WITH PASSWORD 'XYZ';

PGPASSWORD=XYZ psql -h localhost --username=hdmuser -d hdm 

Create a system user hdmuser at OS level. For security reasons no system level access rights are being granted to this account.

Create a database hdm with ownership hdmuser using password XYZ on behalf of user postgres.

Connect to database hdm as user hdmuser using password XYZ.