PostgreSQL#

Install PostgreSQL on a Linux machine#

Type those lines in the command line to install postgreSQL:

sudo apt update
sudo apt install postgresql postgresql-contrib

Create the root user for postgreSQL:

sudo -i -u postgres
psql
CREATE USER <linuxUser> WITH PASSWORD <password>;
CREATE DATABASE <linuxUser> WITH OWNER <linuxUser>;
ALTER ROLE <linuxUser> WITH SUPERUSER;
exit
exit

Create a ‘client’ for wizard users access to the databases:

CREATE USER client WITH PASSWORD <clientPassword>;
CREATE DATABASE client WITH OWNER client;
ALTER ROLE client WITH CREATEDB;

Allow connections to postgreSQL server:

sudo nano /etc/posgresql/13/main/postgresql.conf

Modify the following line and save:

listen_addresses = '*'

Open the pg_hba.conf file:

sudo nano /etc/postgresql/13/main/pg_hba.conf

Modify the following line and save:

# TYPE DATABASE USER CIDR-ADDRESS  METHOD
host  all  all 0.0.0.0/0 md5

Restart postgreSQL:

sudo service postgresql restart

The postgreSQL server should now be accessible via the ip address of the linux machine and the default postgreSQL port ( 5432 )