How to install PostgreSQL 12 on Debian 10?

Windows Articles

Learn how to control the volume of Windows using the mouse wheel.

Hi! Windows recently celebrated its 35th anniversary. Therefore, it is one of the longest lasting and most used systems currently. On the other hand,...

Install Nim programming language on Ubuntu 20.04 / Debian 10

Nowadays, almost everything is done with the help of a computer and a program. And the programs are made through a programming language. That...

Configure Samba File share Services with Ubuntu 20.04 LTS

Here, Today! let's discuss samba file share service with Ubuntu 20.04 LTS. If you need to share files between Linux and MS Windows...

Install Matomo on Ubuntu 20.04

Hello, friends. In this post, you will learn how to install Matomo on Ubuntu 20.04. It's quite useful to measure the traffic to our...

How to change DNS in Windows 10

Hi! Today we will talk a bit about networks. In fact, we will touch on a topic related to connectivity. Specifically we will see...
angeloma
angeloma
Senior Writer and partner

Hi, friends, in this post, I’ll show you how to install PostgreSQL 12 on Debian 10.

PostgreSQL 12 is the latest stable version of what is perhaps the most advanced open-source relational database manager. So many sysadmin need to have it on the different servers.

If you want to know all the news or at least the most important ones, you can read our post

PostgreSQL 12 is available

Well, PostgreSQL 12 comes with many important improvements and it’s a good time to install it. That’s what this post is about.

So let’s go for it.

Install PostgreSQL 12 on Debian

PostgreSQL is included in the official Debian repositories, but not in version 12 but in version 11.

The installation of PostgreSQL 12 is possible thanks to the repository it has for APT package managers that is used by Debian, Ubuntu, Linux Mint and derivatives.

So let’s start.

First, open a terminal session or connect to your server using SSH. Then, install some necessary packages:

:~$ sudo apt install gnupg gnupg2

At the end, the PostgreSQL 12 repository should be added to the list of Debian software sources. To do this, create the following file:

:~$ sudo nano /etc/apt/sources.list.d/pgdg.list

And in it he adds the following:

deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main

1.- Adding the postgresql repository
1.- Adding the postgresql repository

Then save the changes by pressing CTRL + O and close the file by pressing CTRL + X.

For the repository to be accepted by the system, you need to add the gpg key to it. To do this, use the following command:

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

2.- Adding the GPG key for the repository
2.- Adding the GPG key for the repository

Once the process has been completed, simply update the APT cache.

:~$ sudo apt update

You can now view all the packages related to PostgreSQL 12 by typing

:~$ sudo apt install postgresql12

But don’t press enter, just press the TAB key and you’ll see the following:

3.- All postgresql 12 packages
3.- All postgresql 12 packages

As you can see in the image, we have PostgreSQL 12 available. So to install it run the following command:

:~$ sudo apt install postgresql-12
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpq5 libxslt1.1 pgdg-keyring postgresql-client-12 postgresql-client-common postgresql-common sysstat
Suggested packages:
  postgresql-doc-12 libjson-perl isag
The following NEW packages will be installed:
  libpq5 libxslt1.1 pgdg-keyring postgresql-12 postgresql-client-12 postgresql-client-common postgresql-common sysstat
0 upgraded, 8 newly installed, 0 to remove and 51 not upgraded.
Need to get 17.3 MB of archives.
After this operation, 56.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]

4.- Install PostgreSQL 12 on Debian 10
4.- Install PostgreSQL 12 on Debian 10

Now we’ll see if everything went well.

Testing the installation

By default, Debian when installing PostgreSQL starts and enables the service. Therefore, it is ready to be tested. However, if you want to stop the service, you can use this command:

:~$ sudo systemctl stop postgresql

On the other hand, the best way to know if PostgreSQL is ready for work is to execute some command from the console. So we’ll access it first:

:~$ sudo -i -u postgres

Remember that the PostgreSQL console is accessed through the postgres user.

And finally, we access with this command:

:~# psql

Once inside, we can, for example, display all the databases in the system:

:~# \l

5.- All postgresql databases
5.- All postgresql databases

And so we can work without problems with PostgreSQL.

Conclusion

PostgreSQL 12 is a powerful database manager that is used in many projects worldwide. This makes many people want to have the latest stable versions to take even more advantage of the tool.

Please share this post and join our Telegram channel.

More articles

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Learn how to control the volume of Windows using the mouse wheel.

Hi! Windows recently celebrated its 35th anniversary. Therefore, it is one of the longest lasting and most used systems currently. On the other hand,...

Install Nim programming language on Ubuntu 20.04 / Debian 10

Nowadays, almost everything is done with the help of a computer and a program. And the programs are made through a programming language. That...

Configure Samba File share Services with Ubuntu 20.04 LTS

Here, Today! let's discuss samba file share service with Ubuntu 20.04 LTS. If you need to share files between Linux and MS Windows...

Install Matomo on Ubuntu 20.04

Hello, friends. In this post, you will learn how to install Matomo on Ubuntu 20.04. It's quite useful to measure the traffic to our...

How to change DNS in Windows 10

Hi! Today we will talk a bit about networks. In fact, we will touch on a topic related to connectivity. Specifically we will see...
x