PostgreSQL DBA – How to Install PostgreSQL 13 ON RHEL 7
Table of Contents
___________________________________________________________________________________________________
1. How to Integrate PostgreSQL Yum Repository on RHEL7?
2. How to Install PostgreSQL 13 on RHEL 7?
3. How to initialize the database and enable automatic start?
4. How to login PostgreSQL Database?
5. Setup strong password for Postgres user
___________________________________________________________________________________________________
1. How to Integrate PostgreSQL Yum Repository on RHEL7?
[root@rac1 ~]# yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Loaded plugins: langpacks, ulninfo
pgdg-redhat-repo-latest.noarch.rpm | 6.8 kB 00:00:00
Examining /var/tmp/yum-root-sugG6o/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-14.noarch
Marking /var/tmp/yum-root-sugG6o/pgdg-redhat-repo-latest.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-14 will be installed
--> Finished Dependency Resolution
mysql-connectors-community/x86_64 | 2.6 kB 00:00:00
mysql-tools-community/x86_64 | 2.6 kB 00:00:00
mysql80-community/x86_64 | 2.6 kB 00:00:00
ol7_UEKR4/x86_64 | 2.5 kB 00:00:00
ol7_latest/x86_64 | 2.7 kB 00:00:00
ol7_latest/x86_64/updateinfo | 3.2 MB 00:00:00
ol7_latest/x86_64/primary_db | 33 MB 00:00:02
Dependencies Resolved
===============================================================================
Package Arch Version Repository Size
===============================================================================
Installing:
pgdg-redhat-repo noarch 42.0-14 /pgdg-redhat-repo-latest.noarch 11 k
Transaction Summary
==============================================================================
Install 1 Package
Total size: 11 k
Installed size: 11 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : pgdg-redhat-repo-42.0-14.noarch 1/1
Verifying : pgdg-redhat-repo-42.0-14.noarch 1/1
Installed:
pgdg-redhat-repo.noarch 0:42.0-14
Complete!
[root@rac1 ~]#
2. How to Install PostgreSQL 13 on RHEL 7?
[root@rac1 ~]# yum install -y postgresql13-server
Loaded plugins: langpacks, ulninfo
pgdg-common | 2.9 kB 00:00:00
pgdg10 | 3.6 kB 00:00:00
pgdg11 | 3.6 kB 00:00:00
pgdg12 | 3.6 kB 00:00:00
pgdg13 | 3.6 kB 00:00:00
pgdg95 | 3.6 kB 00:00:00
pgdg96 | 3.6 kB 00:00:00
(1/13): pgdg10/7Server/x86_64/group_gz | 245 B 00:00:01
(2/13): pgdg11/7Server/x86_64/group_gz | 245 B 00:00:01
(3/13): pgdg12/7Server/x86_64/group_gz | 245 B 00:00:00
(4/13): pgdg13/7Server/x86_64/group_gz | 246 B 00:00:00
(5/13): pgdg11/7Server/x86_64/primary_db | 320 kB 00:00:02
(6/13): pgdg-common/7Server/x86_64/primary_db | 123 kB 00:00:02
(7/13): pgdg12/7Server/x86_64/primary_db | 182 kB 00:00:00
(8/13): pgdg95/7Server/x86_64/group_gz | 249 B 00:00:00
(9/13): pgdg13/7Server/x86_64/primary_db | 92 kB 00:00:00
(10/13): pgdg96/7Server/x86_64/group_gz | 249 B 00:00:00
(11/13): pgdg96/7Server/x86_64/primary_db | 299 kB 00:00:00
(12/13): pgdg95/7Server/x86_64/primary_db | 272 kB 00:00:00
(13/13): pgdg10/7Server/x86_64/primary_db | 306 kB 00:00:02
Resolving Dependencies
--> Running transaction check
---> Package postgresql13-server.x86_64 0:13.2-1PGDG.rhel7 will be installed
--> Processing Dependency: postgresql13-libs(x86-64) = 13.2-1PGDG.rhel7 for package: postgresql13-server-13.2-1PGDG.rhel7.x86_64
--> Processing Dependency: postgresql13(x86-64) = 13.2-1PGDG.rhel7 for package: postgresql13-server-13.2-1PGDG.rhel7.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql13-server-13.2-1PGDG.rhel7.x86_64
--> Running transaction check
---> Package postgresql13.x86_64 0:13.2-1PGDG.rhel7 will be installed
---> Package postgresql13-libs.x86_64 0:13.2-1PGDG.rhel7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================
Package Arch Version Repository Size
=================================================================================
Installing:
postgresql13-server x86_64 13.2-1PGDG.rhel7 pgdg13 5.4 M
Installing for dependencies:
postgresql13 x86_64 13.2-1PGDG.rhel7 pgdg13 1.4 M
postgresql13-libs x86_64 13.2-1PGDG.rhel7 pgdg13 379 k
Transaction Summary
=============================================================================================================================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 7.2 M
Installed size: 30 M
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/pgdg13/packages/postgresql13-libs-13.2-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY ] 132 kB/s | 223 kB 00:00:53 ETA
Public key for postgresql13-libs-13.2-1PGDG.rhel7.x86_64.rpm is not installed
(1/3): postgresql13-libs-13.2-1PGDG.rhel7.x86_64.rpm | 379 kB 00:00:02
(2/3): postgresql13-13.2-1PGDG.rhel7.x86_64.rpm | 1.4 MB 00:00:03
(3/3): postgresql13-server-13.2-1PGDG.rhel7.x86_64.rpm | 5.4 MB 00:00:11
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 531 kB/s | 7.2 MB 00:00:13
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsqlrpms-hackers@pgfoundry.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package : pgdg-redhat-repo-42.0-14.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : postgresql13-libs-13.2-1PGDG.rhel7.x86_64 1/3
Installing : postgresql13-13.2-1PGDG.rhel7.x86_64 2/3
Installing : postgresql13-server-13.2-1PGDG.rhel7.x86_64 3/3
Verifying : postgresql13-server-13.2-1PGDG.rhel7.x86_64 1/3
Verifying : postgresql13-13.2-1PGDG.rhel7.x86_64 2/3
Verifying : postgresql13-libs-13.2-1PGDG.rhel7.x86_64 3/3
Installed:
postgresql13-server.x86_64 0:13.2-1PGDG.rhel7
Dependency Installed:
postgresql13.x86_64 0:13.2-1PGDG.rhel7 postgresql13-libs.x86_64 0:13.2-1PGDG.rhel7
Complete!
[root@rac1 ~]#
3. How to initialize the database and enable automatic start?
[root@rac1 ~]# /usr/pgsql-13/bin/postgresql-13-setup initdb Initializing database ... OK [root@rac1 ~]# [root@rac1 ~]# systemctl enable postgresql-13 Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-13.service to /usr/lib/systemd/system/postgresql-13.service. [root@rac1 ~]# [root@rac1 ~]# systemctl start postgresql-13 [root@rac1 ~]#
4. How to login PostgreSQL Database?
[root@rac1 ~]# su - postgres [postgres@rac1 ~]$ psql psql (13.2) Type "help" for help. postgres=#
5. Setup strong password for Postgres user
postgres=# alter user postgres with password 'Postgres123#';
ALTER ROLE
postgres=#
Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.
Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
WhatsApp : +
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/