Skip to main content

PostgreSQL installation on REDHAT Installation :-

 

Filesystem Structure of Redhat Linux 8 :-




The PostgreSQL Yum Repository will integrate with your normal systems and patch management, and provide automatic updates for all supported versions of PostgreSQL throughout the support lifetime of PostgreSQL.

The PostgreSQL Yum Repository currently supports:

  • Red Hat Enterprise Linux
  • Rocky Linux
  • CentOS
  • Scientific Linux
  • Oracle Linux
  • Fedora*

*Note: due to the shorter support cycle on Fedora, all supported versions of PostgreSQL are not available on this platform. We do not recommend using Fedora for server deployments.

To use the PostgreSQL Yum Repository, follow these steps:


Last login: Tue Jul 27 08:14:33 2021

[root@localhost ~]# sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

Updating Subscription Management repositories.

Last metadata expiration check: 0:06:03 ago on Tue 27 Jul 2021 08:15:28 AM PDT.

pgdg-redhat-repo-latest.noarch.rpm                                                                                                                            13 kB/s |  12 kB     00:00

Dependencies resolved.

=============================================================================================================================================================================================

 Package                                            Architecture                             Version                                    Repository                                      Size

=============================================================================================================================================================================================

Installing:

 pgdg-redhat-repo                                   noarch                                   42.0-19                                    @commandline                                    12 k


Transaction Summary

=============================================================================================================================================================================================

Install  1 Package


Total size: 12 k

Installed size: 12 k

Downloading Packages:

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                                                     1/1

  Installing       : pgdg-redhat-repo-42.0-19.noarch                                                                                                                                     1/1

  Verifying        : pgdg-redhat-repo-42.0-19.noarch                                                                                                                                     1/1

Installed products updated.


Installed:

  pgdg-redhat-repo-42.0-19.noarch


Complete!

[root@localhost ~]# sudo dnf -qy module disable postgresql

Importing GPG key 0x442DF0F8:

 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"

 Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

Importing GPG key 0x442DF0F8:

 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"

 Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

Importing GPG key 0x442DF0F8:

 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"

 Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

Importing GPG key 0x442DF0F8:

 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"

 Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

Importing GPG key 0x442DF0F8:

 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"

 Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

Importing GPG key 0x442DF0F8:

 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"

 Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[root@localhost ~]# sudo dnf install -y postgresql13-server

Updating Subscription Management repositories.

Last metadata expiration check: 0:00:28 ago on Tue 27 Jul 2021 08:30:56 AM PDT.

Dependencies resolved.

=============================================================================================================================================================================================

 Package                                             Architecture                           Version                                             Repository                              Size

=============================================================================================================================================================================================

Installing:

 postgresql13-server                                 x86_64                                 13.3-2PGDG.rhel8                                    pgdg13                                 5.5 M

Installing dependencies:

 postgresql13                                        x86_64                                 13.3-2PGDG.rhel8                                    pgdg13                                 1.5 M

 postgresql13-libs                                   x86_64                                 13.3-2PGDG.rhel8                                    pgdg13                                 413 k


Transaction Summary

=============================================================================================================================================================================================

Install  3 Packages


Total download size: 7.4 M

Installed size: 31 M

Downloading Packages:

(1/3): postgresql13-libs-13.3-2PGDG.rhel8.x86_64.rpm                                                                                                         132 kB/s | 413 kB     00:03

(2/3): postgresql13-13.3-2PGDG.rhel8.x86_64.rpm                                                                                                              160 kB/s | 1.5 MB     00:09

(3/3): postgresql13-server-13.3-2PGDG.rhel8.x86_64.rpm                                                                                                       484 kB/s | 5.5 MB     00:11

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                                        646 kB/s | 7.4 MB     00:11

warning: /var/cache/dnf/pgdg13-e81daebfc8b779ec/packages/postgresql13-13.3-2PGDG.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 <pgsql-pkg-yum@postgresql.org>"

 Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

Key imported successfully

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                                                     1/1

  Installing       : postgresql13-libs-13.3-2PGDG.rhel8.x86_64                                                                                                                           1/3

  Running scriptlet: postgresql13-libs-13.3-2PGDG.rhel8.x86_64                                                                                                                           1/3

  Installing       : postgresql13-13.3-2PGDG.rhel8.x86_64                                                                                                                                2/3

  Running scriptlet: postgresql13-13.3-2PGDG.rhel8.x86_64                                                                                                                                2/3

  Running scriptlet: postgresql13-server-13.3-2PGDG.rhel8.x86_64                                                                                                                         3/3

  Installing       : postgresql13-server-13.3-2PGDG.rhel8.x86_64                                                                                                                         3/3

  Running scriptlet: postgresql13-server-13.3-2PGDG.rhel8.x86_64                                                                                                                         3/3

  Verifying        : postgresql13-13.3-2PGDG.rhel8.x86_64                                                                                                                                1/3

  Verifying        : postgresql13-libs-13.3-2PGDG.rhel8.x86_64                                                                                                                           2/3

  Verifying        : postgresql13-server-13.3-2PGDG.rhel8.x86_64                                                                                                                         3/3

Installed products updated.


Installed:

  postgresql13-13.3-2PGDG.rhel8.x86_64                      postgresql13-libs-13.3-2PGDG.rhel8.x86_64                      postgresql13-server-13.3-2PGDG.rhel8.x86_64


Complete!

[root@localhost ~]# sudo /usr/pgsql-13/bin/postgresql-13-setup initdb

Initializing database ... OK


[root@localhost ~]# sudo systemctl enable postgresql-13

Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-13.service → /usr/lib/systemd/system/postgresql-13.service.

[root@localhost ~]# sudo systemctl start postgresql-13

[root@localhost ~]# su - postgres

[postgres@localhost ~]$ ps -ef|grep post

postgres   35268       1  0 08:37 ?        00:00:00 /usr/pgsql-13/bin/postmaster -D /var/lib/pgsql/13/data/

postgres   35270   35268  0 08:37 ?        00:00:00 postgres: logger

postgres   35272   35268  0 08:37 ?        00:00:00 postgres: checkpointer

postgres   35273   35268  0 08:37 ?        00:00:00 postgres: background writer

postgres   35274   35268  0 08:37 ?        00:00:00 postgres: walwriter

postgres   35275   35268  0 08:37 ?        00:00:00 postgres: autovacuum launcher

postgres   35276   35268  0 08:37 ?        00:00:00 postgres: stats collector

postgres   35277   35268  0 08:37 ?        00:00:00 postgres: logical replication launcher

root       35384   34090  0 08:39 pts/0    00:00:00 su - postgres

postgres   35385   35384  1 08:39 pts/0    00:00:00 -bash

postgres   35437   35385  0 08:39 pts/0    00:00:00 ps -ef

postgres   35438   35385  0 08:39 pts/0    00:00:00 grep --color=auto post

Comments

Popular posts from this blog

PostgreSQL Vacuum and Vacuum full are not two different processes

  PostgreSQL’s   VACUUM   and   VACUUM FULL   are not separate processes but rather different operational modes of the same maintenance command. Here’s why: Core Implementation Both commands share the same underlying codebase and are executed through the  vacuum_rel()  function in PostgreSQL’s source code ( src/backend/commands/vacuum.c ). The key distinction lies in the  FULL  option, which triggers additional steps: Standard  VACUUM : Removes dead tuples (obsolete rows) and marks space reusable  within PostgreSQL Updates the visibility map to optimize future queries Runs concurrently with read/write operations VACUUM FULL : Rewrites the entire table into a new disk file, compressing it and reclaiming space for the  operating system Rebuilds all indexes and requires an  ACCESS EXCLUSIVE  lock, blocking other operations Key Differences in Behavior Aspect Standard VACUUM VACUUM FULL Space Reclamation Internal reuse onl...

Job scheduler for PostgreSQL "pg_cron"

What is pg_cron   : -   pg_cron is a simple cron-based job scheduler for   PostgreSQL (9.5 or higher)   that runs inside the database as an extension. It uses the same syntax as regular cron, but it allows you to schedule PostgreSQL commands directly from the database . Why We need it ? Running periodic maintenance jobs or removing old data is a common requirement in PostgreSQL. A simple way to achieve this is to configure cron or another external daemon to periodically connect to the database and run a command. Let's see how it's works  Step 1 :-  For implementing/Installation of pg_cron you need to download source code from git Dowload link  export PATH=/usr/local/pgsql/bin:$PATH wget https://github.com/citusdata/pg_cron/archive/master.zip unzip master cd pg_cron-master/ make make install    Step 2 : - To start the pg_cron background worker when PostgreSQL starts, you need to add pg_cron to  shared_preload_libraries   in post...

All about pg_hba.conf(authentication methods- Postgresql)

  pg_hba.conf is the PostgreSQL access policy configuration file, which is located in the /var/lib/pgsql/10/data/ directory (PostgreSQL10) by default. The configuration file has 5 parameters, namely: TYPE (host type), DATABASE (database name), USER (user name), ADDRESS (IP address and mask), METHOD (encryption method) host all all 192.168.109.103/22 md5 host dbName user 192.168.109.106/22 trust Modify the server-side pg_hba.conf file Make the shell can connect to the postgres database secretly: Modify the authentication file $PGDATA/pg_hba.conf, add the following lines, and reload to make the configuration take effect immediately. host pankajconnect postgresql 192.168.8.103/32 trust Reload to take effect: pg_ctl reload -D $PGDATA Examples: 1. Allow local login to the database using PGAdmin3, database address  localhost, user user1, database user1db: host user1db user1 127.0.0.1/32 md5 2. Allow 10.1.1.0~10.1.1.255 network segments to log in to the database: host all all 10.1.1....