Skip to main content

HowTo: Install PostGreSQL

Adapted steps from here: https://www.c-sharpcorner.com/article/crud-operations-in-postgresql-with-ef-core-and-asp-net-core-web-api/

Download

PostgreSQL can be downloaded from here: https://www.postgresql.org/download/

image.png

NOTE: We are installing on Ubuntu v24.04 in this tutorial.

Select Linux and Ubuntu from the click boxes.

Install

Run this to install PostgreSQL:

sudo apt install postgresql

Listener

By default, Postgres only listens on the localhost adapter.
We will change it to listen on all adapters.

NOTE: If you only want it to listen on a specific IP, use that.

Navigate to /etc/postgresql/*/main/, and open postgresql.conf.

Change the listen address to '*'. It might not be set, at all.

image.png

Set Postgres Password

Now, we need to set the password for the postgres user.

Run this in the terminal, to open the default template database:

sudo -u postgres psql template1

image.png

Set the password for the postgres user with this:

ALTER USER postgres with encrypted password 'your_password';