sudo apt-get update && sudo apt-get upgrade

sudo apt-get install postgresql postgresql-contrib

Update password for default root postgres user

// This password uses for login the Linux System not for the Database Connection
sudo passwd postgres

Setup User and Password for Database connection

// switch to the postgres user that You just updated the password before
su - postgres

// change the password of the current default postgres user of database
psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'MY_PASSWORD';"

// Created Test DB
createdb mytestdb

// Connect to Test DB
psql mytestdb

// Database Connection
postgresql://postgres:MY_PASSWORD@localhost:5432/mytestdb?schema=public

Check the usage of Memory (Ram)

// By megabyte
free -m

// By gigabyte
free -h

Check the usage of Hard drive

// By megabyte
df -Tm

// By gigabyte
df -Th

Install Swap File

// Change the parameter {{X}} to the number of Gb that You want to allocate for the Swap

sudo fallocate -l {{X}}G /swapfile

sudo chmod 600 /swapfile

sudo mkswap /swapfile

sudo swapon /swapfile