In this short guide we will perform the installation of PostgreSQL 13 database server on Oracle Linux 8 server. PostgreSQL is a powerful relational database management system created for running mission critical Production workloads. PostgreSQL has huge community of contributors that ensures a robust, highly reliable and scalable database system is delivered. Refer to the next steps outlined in this post to install and run PostgreSQL 13 on Oracle Linux 8.

Add PostgreSQL repository

The first installation step is adding the official PostgreSQL repository to your Oracle Linux 8 machine.

sudo dnf install

Accept installation prompt:

Dependencies resolved.
 Package                                     Architecture                      Version                              Repository                               Size
 pgdg-redhat-repo                            noarch                            42.0-14                              @commandline                             11 k

Transaction Summary
Install  1 Package

Total size: 11 k
Installed size: 11 k
Is this ok [y/N]: y

The repository file is created as:

$ cat /etc/yum.repos.d/pgdg-redhat-all.repo

Check available repositories using yum command:

$ sudo dnf repolist
repo id                                              repo name
ol8_UEKR6                                            Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64)
ol8_appstream                                        Oracle Linux 8 Application Stream (x86_64)
ol8_baseos_latest                                    Oracle Linux 8 BaseOS Latest (x86_64)
pgdg-common                                          PostgreSQL common RPMs for RHEL/CentOS 8 - x86_64
pgdg10                                               PostgreSQL 10 for RHEL/CentOS 8 - x86_64
pgdg11                                               PostgreSQL 11 for RHEL/CentOS 8 - x86_64
pgdg12                                               PostgreSQL 12 for RHEL/CentOS 8 - x86_64
pgdg13                                               PostgreSQL 13 for RHEL/CentOS 8 - x86_64
pgdg95                                               PostgreSQL 9.5 for RHEL/CentOS 8 - x86_64
pgdg96                                               PostgreSQL 9.6 for RHEL/CentOS 8 - x86_64

Install PostgreSQL 13 on Oracle Linux 8

Disable the PostgreSQL AppStream repository on Oracle Linux 8:

sudo dnf -qy module disable postgresql

Try a search for PostgreSQL 13 packages on Oracle Linux 8:

$ sudo dnf search postgresql13

To install PostgreSQL 13 server and client on Oracle Linux 8 system run the following commands:

sudo dnf install postgresql13 postgresql13-server

Hit the y key to accept installation:

Dependencies resolved.
 Package                                       Architecture                     Version                                    Repository                        Size
 postgresql13                                  x86_64                           13.0-1PGDG.rhel8                           pgdg13                           1.4 M
 postgresql13-server                           x86_64                           13.0-1PGDG.rhel8                           pgdg13                           5.5 M
Installing dependencies:
 postgresql13-libs                             x86_64                           13.0-1PGDG.rhel8                           pgdg13                           411 k

Transaction Summary
Install  3 Packages

Total download size: 7.4 M
Installed size: 31 M
Is this ok [y/N]: y

Ensure GPG keys are imported:

Total                                                                                                                             993 kB/s | 7.4 MB     00:07
warning: /var/cache/dnf/pgdg13-e81daebfc8b779ec/packages/postgresql13-13.0-1PGDG.rhel8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
PostgreSQL 13 for RHEL/CentOS 8 - x86_64                                                                                          1.6 MB/s | 1.7 kB     00:00
Importing GPG key 0x442DF0F8:
 Userid     : "PostgreSQL RPM Building Project <[email protected]>"
 Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y

Configure and Start PostgreSQL 13 on Oracle Linux 8

Run database configuration script:

$ sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
Initializing database ... OK

Start and enable the database service:

$ sudo systemctl enable --now postgresql-13
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/postgresql-13.service.

Check service status to confirm it is in running state:

$ systemctl status postgresql-13
● postgresql-13.service - PostgreSQL 13 database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql-13.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2020-11-03 21:46:11 UTC; 2min 24s ago
  Process: 5103 ExecStartPre=/usr/pgsql-13/bin/postgresql-13-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 5108 (postmaster)
    Tasks: 8 (limit: 4232)
   Memory: 17.2M
   CGroup: /system.slice/postgresql-13.service
           ├─5108 /usr/pgsql-13/bin/postmaster -D /var/lib/pgsql/13/data/
           ├─5110 postgres: logger
           ├─5112 postgres: checkpointer
           ├─5113 postgres: background writer
           ├─5114 postgres: walwriter
           ├─5115 postgres: autovacuum launcher
           ├─5116 postgres: stats collector
           └─5117 postgres: logical replication launcher

To initiate connection to the PostgreSQL shell, run:

$ sudo su - postgres
[[email protected] ~]$ psql
psql (13.0)
Type "help" for help.

Test command execution:

postgres=# SELECT VERSION ();
 PostgreSQL 13.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5), 64-bit
(1 row)

postgres=# \q
[[email protected] ~]$ exit

And that’s how you can quickly install and run PostgreSQL 13 database server on Oracle Linux 8 system.

Best Video courses to Learn PostgreSQL Database:

More articles on Oracle Linux 8:

How To Install Joomla CMS With Nginx on Oracle Linux

Setup Pritunl VPN Server on CentOS | Oracle Linux

How To Install LibreNMS On Oracle Linux

Install Zabbix 5 LTS With Nginx on Oracle Linux


Please enter your comment!
Please enter your name here