One of the possible options:
apt install postgresql
Check if postgresql service is run:
systemctl status postgresql
it should return something like this:
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
Active: active (exited) since Sun 2022-03-20 22:57:58 EET; 23min ago
Main PID: 53645 (code=exited, status=0/SUCCESS)
CPU: 1ms
Mar 20 22:57:58 username systemd[1]: Starting PostgreSQL RDBMS...
Mar 20 22:57:58 username systemd[1]: Finished PostgreSQL RDBMS.
Connect to postgresql:
runuser -u postgres psql
or
sudo -u postgres
Create databases:
CREATE DATABASE appointment_dev;
CREATE DATABASE appointment_test;
CREATE DATABASE appointment_prod;
Create user:
create user root with encrypted password '1234';
Grant permissions to a new user:
grant all privileges on database appointment_dev to root;
grant all privileges on database appointment_test to root;
grant all privileges on database appointment_prod to root;