Check out example codes for "install postgresql ubuntu". It will help you in understanding the concepts better.

Code Example 1

sudo apt update
sudo apt install postgresql postgresql-contrib

Code Example 2

sudo apt install postgresql postgresql-contrib

Code Example 3

sudo apt update
sudo apt install postgresql postgresql-contrib

sudo -u postgres createuser --interactive

sudo -u postgres createdb database1

Code Example 4

psql

Code Example 5

sudo su - postgres

Learn ReactJs, React Native from akashmittal.com