How to install PostgreSQL 12 on Ubuntu 18.04?

Windows Articles

How to install KVM on Debian 10?

Hello friends, in this post I will show you how to install KVM on Debian 10. KVM stands for...

How to open Windows 10 Mobility Center

Hello! There are many types of users of Windows 10. As it depends on the type of hardware used. That is, the...

Ubuntu 20.04.1 available

Canonical, the company led by Mark Shuttleworth, releases Ubuntu 20.04.1. It has a new image, with updates and security patches for the...

How to install Linux Kernel 5.8 on Ubuntu 20.04?

Upgrading the Linux Kernel can be a beneficial task, but it is always optional. Recently we talked about the Linux Kernel 5.8...

How to activate XPS Viewer in Windows 10

Hey, what's up! When working with Windows 10 we probably use a lot of files. Indeed, these files have many extensions. For...
angeloma
angeloma
Senior Writer and partner

To develop great applications you need a great database manager. So, that is why in this post I will teach you how to install PostgreSQL 12 on Ubuntu 18.04.

PostgreSQL

PostgreSQL is one of the most advanced and modern relational database managers out there. It is always shown as the immediate competitor of MySQL and MariaDB in the segment of open source and community database managers.

One of the main advantages of using PostgreSQL is that it has extensive documentation and supports powerful features. All this in an open-source and free application.

And recently version 12 has been released. If you want to know more about it read our post about it.

PostgreSQL 12.0 is available

So, let us start to work.

Install PostgreSQL 12 on Ubuntu 18.04

The best way to install PostgreSQL 12 on Ubuntu 18.04 is to use the repository that PostgreSQL developers make available to us.

In addition, it is a very secure repository with good support for Ubuntu.

So, install some necessary packages.

:~$ sudo apt install curl ca-certificates gnupg

Then, download and add the GPG key from the repository to further secure the installation.

:~$ curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
1.- Downloading the GPG key for the repository
1.- Downloading the GPG key for the repository

Now, we have to add the PostgreSQL repository. To do this, create a source file in /etc/apt/sources.list.d/ and add the following:

:~$ sudo nano /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main

Then, save the changes and close the editor.

Finally, install PostgreSQL 12 on Ubuntu 18.04 using the following command.

:~$ sudo apt update && sudo apt install postgresql-12
2.- Install PostgreSQL on Ubuntu 18.04
2.- Install PostgreSQL on Ubuntu 18.04

Now, let’s make sure everything works.

Testing the installation

Of course, there are many ways to test whether everything went well. However, so as not to lengthen the post unnecessarily, we’ll just open the PostgreSQL console and run a command.

First, we have to change to the postgres user. This user is created during installation.

:~$ sudo -i -u postgres

This user has access to the PostgreSQL console. So just access it.

:~# psql

And inside we’ll be able to execute whatever commands we want. In this case, we will be satisfied with simply listing the example databases.

:~# \l
3.- PostgreSQL 12 on Ubuntu 18.04
3.- PostgreSQL 12 on Ubuntu 18.04

This way when showing the existing databases, we will know that everything has worked.

That is it. So, you can now use the latest version of PostgreSQL on Ubuntu 18.04.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to install KVM on Debian 10?

Hello friends, in this post I will show you how to install KVM on Debian 10. KVM stands for...

How to open Windows 10 Mobility Center

Hello! There are many types of users of Windows 10. As it depends on the type of hardware used. That is, the...

Ubuntu 20.04.1 available

Canonical, the company led by Mark Shuttleworth, releases Ubuntu 20.04.1. It has a new image, with updates and security patches for the...

How to install Linux Kernel 5.8 on Ubuntu 20.04?

Upgrading the Linux Kernel can be a beneficial task, but it is always optional. Recently we talked about the Linux Kernel 5.8...

How to activate XPS Viewer in Windows 10

Hey, what's up! When working with Windows 10 we probably use a lot of files. Indeed, these files have many extensions. For...