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 a Postgres implies a number of actions:

checking the technical characteristics of the server and its preparation;

updating packages;

installing a Postress and updating roles.

Step 1. Find and configure the server to work

The minimum requirements for a local and/or virtual machine are 2 processor cores and 8 GB of memory. Ideally, if the configuration implies more advanced characteristics.

Step 2. Update Packages

To update packages, use the command:

$ sudo apt update

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

$ sudo apt install postgresql postgresql-contrib

Step 3. Configure roles and accounts in PostgreSQ

After installing the Postgres, you need to figure out how to configure roles. By default, the identity authentication option is used. I.e., the roles in the Post are linked to the account.

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

$ sudo -i -u postgres

In order to work from the Postgress command line (and already interact with the database from it), enter:

$ psql

The settings imply that the user will 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