Methods of payment Abuse

How to install PostgreSQL in Ubuntu 20.04

24.12.2022, 18:10

PostgreSQ (Postgres) is a database management system that is an implementation of SQL.

Step-by-step instructions for installing Postgres involve a number of actions:

checking the technical characteristics of the server and preparing it;

updating packages;

installing Postgres and updating roles.

Step 1: Find and configure a server to work on

The minimum requirements for a local and/or virtual machine are 2 CPU cores and 8GB of memory. It is ideal if the configuration will involve more advanced features.

Step 2: Update packages

A command is used to update packages:

$ sudo apt update

As a rule, standard settings and parameters are not enough for professional development. It is for this reason that we put a package with additional utilities. This is done with the command:

$ sudo apt install postgresql postgresql-contrib

Step 3: Configure roles and accounts in PostgreSQ

After installing Postgres, we need to figure out how to configure roles. By default, the ident authentication option is used. That is, roles in Postgres are bound to an account.

During installation a postgres account was created to work with the corresponding role. To navigate to it, enter:

$ sudo -i -u postgres

To work from the Postgres command line (and from it already interact with the database), enter:

$ psql

The settings imply that the user will also be able to create a new role or a new database.

Now you know how to install PostgreSQ on Ubuntu 20.04 and start working with relational databases to perform backend tasks