'I am unable to install PostgreSQL 12 on Red Hat 8.1 after following official instructions using dnf

Official Instructions I have been trying to install PostgreSQL 12 but I get the following error: No match for argument: postgresql12 Error: Unable to find a match: postgresql12

When I run the command sudo dnf repolist this is what I get:

$ sudo dnf repolist
Updating Subscription Management repositories.
This system is registered to Red Hat Subscription Management, but is not receiving updates. You can use subscription-manager to assign subscriptions.
Last metadata expiration check: 0:04:00 ago on Mon 24 Feb 2020 05:44:02 PM EST.
Modular dependency problems:

 Problem 1: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8010020190322125518:073fa5fe-0.x86_64
 Problem 2: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020190322130042:16b3ab4d-0.x86_64
repo id                                                              repo name                                                                                                     status
*epel                                                                Extra Packages for Enterprise Linux 8 - x86_64                                                                4,885
*epel-modular                                                        Extra Packages for Enterprise Linux Modular 8 - x86_64                                                            0
pgdg10                                                               PostgreSQL 10 for RHEL/CentOS 8 - x86_64                                                                        793
pgdg11                                                               PostgreSQL 11 for RHEL/CentOS 8 - x86_64                                                                        838
pgdg12                                                               PostgreSQL 12 for RHEL/CentOS 8 - x86_64                                                                        635
pgdg94                                                               PostgreSQL 9.4 for RHEL/CentOS 8 - x86_64                                                                       346
pgdg95                                                               PostgreSQL 9.5 for RHEL/CentOS 8 - x86_64                                                                       516
pgdg96                                                               PostgreSQL 9.6 for RHEL/CentOS 8 - x86_64                                                                       761

When I run the command sudo yum list postgresql12* here is what I get:

sudo yum list postgresql12*
Updating Subscription Management repositories.
This system is registered to Red Hat Subscription Management, but is not receiving updates. You can use subscription-manager to assign subscriptions.
Last metadata expiration check: 0:06:49 ago on Mon 24 Feb 2020 05:44:02 PM EST.
Modular dependency problems:

 Problem 1: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8010020190322125518:073fa5fe-0.x86_64
 Problem 2: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020190322130042:16b3ab4d-0.x86_64
Available Packages
postgresql12-contrib-debuginfo.x86_64                                                             12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-debuginfo.x86_64                                                                     12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-debugsource.x86_64                                                                   12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-devel.x86_64                                                                         12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-devel-debuginfo.x86_64                                                               12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-libs.x86_64                                                                          12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-libs-debuginfo.x86_64                                                                12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-llvmjit.x86_64                                                                       12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-llvmjit-debuginfo.x86_64                                                             12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-odbc.x86_64                                                                          12.01.0000-1PGDG.rhel8                                                           pgdg12
postgresql12-plperl-debuginfo.x86_64                                                              12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-plpython.x86_64                                                                      12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-plpython-debuginfo.x86_64                                                            12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-plpython3-debuginfo.x86_64                                                           12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-pltcl-debuginfo.x86_64                                                               12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-server-debuginfo.x86_64                                                              12.2-2PGDG.rhel8                                                                 pgdg12
postgresql12-test-debuginfo.x86_64                                                                12.2-2PGDG.rhel8                                                                 pgdg12

Nothing happens when I try to disable the postgresql module:

sudo dnf -qy module disable postgresql
Error: Problems in request:
Modular dependency problems:

 Problem 1: conflicting requests
 - nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8010020190322125518:073fa5fe-0.x86_64
 Problem 2: conflicting requests
 - nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020190322130042:16b3ab4d-0.x86_64


Solution 1:[1]

I wish I knew the full reason why - but you need to enable the postgresql 12 module:

dnf enable postgresql:12

Solution 2:[2]

This worked for me; run this:

sudo dnf -y module disable postgresql

Then :

sudo yum install postgresql12-server postgresql12

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DrOffler
Solution 2 Jeremy Caney