In this post we are going to install PostgreSQL Server version 12.2 on Red Hat Enterprise Linux 8, this PostgreSQL server will be used for the next posts about migration of data between different databases.
1. We are going to check if a previous version of PostgreSQL Server was installed in the Linux Server.
[root@dbserver ~]# /usr/bin/psql --version
psql (PostgreSQL) 10.6
2. Because PostgreSQL version 10.6 was installed previously we are going to remove it from the server.
[root@dbserver ~]# yum remove postgres\*
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
postgresql x86_64 10.6-1.module+el8+2469+5ecd5aae
@rhui-rhel-8-appstream-rhui-rpms 5.6 M
Removing unused dependencies:
libpq x86_64 12.1-3.el8 @rhui-rhel-8-appstream-rhui-rpms 808 k
Transaction Summary
================================================================================
Remove 2 Packages
Freed space: 6.4 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Erasing : postgresql-10.6-1.module+el8+2469+5ecd5aae.x86_64 1/2
Erasing : libpq-12.1-3.el8.x86_64 2/2
Running scriptlet: libpq-12.1-3.el8.x86_64 2/2
Verifying : libpq-12.1-3.el8.x86_64 1/2
Verifying : postgresql-10.6-1.module+el8+2469+5ecd5aae.x86_64 2/2
Removed:
postgresql-10.6-1.module+el8+2469+5ecd5aae.x86_64 libpq-12.1-3.el8.x86_64
Complete!
3. Install the repository RPM .
[root@dbserver ~]# dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Last metadata expiration check: 0:03:21 ago on Fri 27 Mar 2020 08:45:56 PM UTC.
pgdg-redhat-repo-latest.noarch.rpm 7.1 kB/s | 10 kB 00:01
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
pgdg-redhat-repo noarch 42.0-8 @commandline 10 k
Transaction Summary
================================================================================
Install 1 Package
Total size: 10 k
Installed size: 11 k
Is this ok [y/N]: y
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-8.noarch 1/1
Verifying : pgdg-redhat-repo-42.0-8.noarch 1/1
Installed:
pgdg-redhat-repo-42.0-8.noarch
Complete!
4. Disable the built-in PostgreSQL module
[root@dbserver ~]# dnf -qy module disable postgresql
5. Install the client packages version 12
[root@dbserver ~]# dnf install postgresql12
Last metadata expiration check: 0:00:09 ago on Fri 27 Mar 2020 08:49:51 PM UTC.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
postgresql12 x86_64 12.2-2PGDG.rhel8 pgdg12 1.6 M
Installing dependencies:
postgresql12-libs x86_64 12.2-2PGDG.rhel8 pgdg12 395 k
libicu x86_64 60.3-2.el8_1 rhui-rhel-8-baseos-rhui-rpms 8.8 M
Transaction Summary
================================================================================
Install 3 Packages
Total download size: 11 M
Installed size: 43 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): libicu-60.3-2.el8_1.x86_64.rpm 6.7 MB/s | 8.8 MB 00:01
(2/3): postgresql12-libs-12.2-2PGDG.rhel8.x86_6 225 kB/s | 395 kB 00:01
(3/3): postgresql12-12.2-2PGDG.rhel8.x86_64.rpm 802 kB/s | 1.6 MB 00:02
--------------------------------------------------------------------------------
Total 3.5 MB/s | 11 MB 00:03
warning: /var/cache/dnf/pgdg12-64e2194e85277659/packages/postgresql12-12.2-2PGDG.rhel8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
PostgreSQL 12 for RHEL/CentOS 8 - x86_64 1.6 MB/s | 1.7 kB 00:00
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsqlrpms-hackers@pgfoundry.org>"
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
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : libicu-60.3-2.el8_1.x86_64 1/3
Running scriptlet: libicu-60.3-2.el8_1.x86_64 1/3
Installing : postgresql12-libs-12.2-2PGDG.rhel8.x86_64 2/3
Running scriptlet: postgresql12-libs-12.2-2PGDG.rhel8.x86_64 2/3
Installing : postgresql12-12.2-2PGDG.rhel8.x86_64 3/3
Running scriptlet: postgresql12-12.2-2PGDG.rhel8.x86_64 3/3
Verifying : postgresql12-12.2-2PGDG.rhel8.x86_64 1/3
Verifying : postgresql12-libs-12.2-2PGDG.rhel8.x86_64 2/3
Verifying : libicu-60.3-2.el8_1.x86_64 3/3
Installed:
postgresql12-12.2-2PGDG.rhel8.x86_64
postgresql12-libs-12.2-2PGDG.rhel8.x86_64
libicu-60.3-2.el8_1.x86_64
Complete!
6. Install the server packages versin 12
[root@dbserver ~]# dnf install postgresql12-server
Last metadata expiration check: 0:00:47 ago on Fri 27 Mar 2020 08:49:51 PM UTC.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
postgresql12-server x86_64 12.2-2PGDG.rhel8 pgdg12 5.1 M
Transaction Summary
================================================================================
Install 1 Package
Total download size: 5.1 M
Installed size: 22 M
Is this ok [y/N]: y
Downloading Packages:
postgresql12-server-12.2-2PGDG.rhel8.x86_64.rpm 3.4 MB/s | 5.1 MB 00:01
--------------------------------------------------------------------------------
Total 3.4 MB/s | 5.1 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: postgresql12-server-12.2-2PGDG.rhel8.x86_64 1/1
Installing : postgresql12-server-12.2-2PGDG.rhel8.x86_64 1/1
Running scriptlet: postgresql12-server-12.2-2PGDG.rhel8.x86_64 1/1
Verifying : postgresql12-server-12.2-2PGDG.rhel8.x86_64 1/1
Installed:
postgresql12-server-12.2-2PGDG.rhel8.x86_64
Complete!
7. Initialize the database
[root@dbserver ~]# /usr/pgsql-12/bin/postgresql-12-setup initdb
Initializing database ... OK
8. Enable automatic start of PostgreSQL database Server.
[root@dbserver ~]# systemctl enable postgresql-12
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-12.service ? /usr/lib/systemd/system/postgresql-12.service.
[root@dbserver ~]# systemctl start postgresql-12
9. Check the installed version of PostgreSQL server.
[root@ip-172-31-87-123 ~]# /usr/bin/psql --version
psql (PostgreSQL) 12.2
10. Set the password for the user postgres
[postgres@dbserver ~]$ psql
psql (12.2)
Type "help" for help.
postgres=# alter user postgres password 'oracle';
ALTER ROLE
postgres=#
Mar 27 2020
Install PostgreSQL Server 12.2 on RHEL 8
In this post we are going to install PostgreSQL Server version 12.2 on Red Hat Enterprise Linux 8, this PostgreSQL server will be used for the next posts about migration of data between different databases.
1. We are going to check if a previous version of PostgreSQL Server was installed in the Linux Server.
2. Because PostgreSQL version 10.6 was installed previously we are going to remove it from the server.
3. Install the repository RPM .
4. Disable the built-in PostgreSQL module
5. Install the client packages version 12
6. Install the server packages versin 12
7. Initialize the database
8. Enable automatic start of PostgreSQL database Server.
9. Check the installed version of PostgreSQL server.
10. Set the password for the user postgres
By DBA_JAF • Databases, PostgreSQL • 0