How to install and Configure PostgreSQL on Linux Mint 21

In this article, we will see how to install and Configure PostgreSQL on Linux Mint 21 step by step.

Install and configure PostgreSQL on Linux Mint 21:

1. Create the file repository configuration:

sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

How to install and Configure PostgreSQL on Linux Mint 21

2. Import the repository signing key:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

3. Now update the package list:

sudo apt-get update

4. Now install the PostgreSQL on Linux Mint 21 using below command.

sudo apt-get install postgresql postgresql-client postgresql-contrib

Post installation steps of PostgreSQL server on Linux Mint:

1. Verify PostgreSQL Server status by running below command on Linu Mint:

sudo systemctl status postgresql

2. Connect to PostgreSQL Server using below commands:

sudo su - postgres psql

3. Now verify the version of PostgreSQL Server installed on Linux Mint 21.

select version();

4. Set the password for postgres user in Linux Mint:

alter user postgres with password 'admin@123';

5. Create a database in PostgreSQL on Linux Mint:

create database r2schools;/pre>

6. Create PostgreSQL user in Linux Mint

create user r2admin with password 'admin@123';/pre>

7. Restart PostgreSQL server on Linux Mint 21:

sudo systemctl restart postgresql/pre>

So, we have successfully installed and configured PostgreSQL on Linux Mint 21.

For the same please watch below videp: