PostgreSQL-13 RPM Installation on Linux 7
PostgreSQL was
developed for UNIX-like platforms, however, it was designed to be portable. It
means that PostgreSQL can also run on other platforms such as Mac OS X,
Solaris, and Windows.
Since version 8.0,
PostgreSQL offers an installer for Windows systems that makes the installation
process easier and faster. For development purpose, we will install PostgreSQL
version 13 on Linux.
Postgres
database installation 3 types, they are
1. GRAPHICAL Installation (./ postgresql.run)
2. BINARY INSTALLATION ( RPM )
3. SOURCE CODE INSTALLATION (./configure)
Note: We are doing POSTGRES BINARY
INSTALLATION (RPM):
=================================================
Select version : 13
Select platform: Oracle Linux 7
Select architecture: x86_64
Download
PostgreSQL 13 for Linux 7:
Step 1. As root user install the below packages
- postgresql13 - PostgreSQL client programs and
libraries
- postgresql13-contrib - Contributed source and binaries
distributed with PostgreSQL
- postgresql13-libs - The shared libraries required for
any PostgreSQL clients
- postgresql13-server - The programs needed to create and
run a PostgreSQL server
Note:- Sequence of rpm installation as
below otherwise you will get an error of Failed dependencies
1) postgresql13-libs-13.0-1PGDG.rhel7.x86_64.rpm
2) postgresql13-13.0-1PGDG.rhel7.x86_64.rpm
3) postgresql13-server-13.0-1PGDG.rhel7.x86_64.rpm
4) postgresql13-contrib-13.0-1PGDG.rhel7.x86_64.rpm
warning: postgresql13-libs-13.0-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:postgresql13-libs-13.0-1PGDG.rhel################################# [100%]
[root@rac5 Desktop]#
[root@rac5 Desktop]# rpm -ivh postgresql13-contrib-13.0-1PGDG.rhel7.x86_64.rpm
warning: postgresql13-contrib-13.0-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
error: Failed dependencies:
postgresql13(x86-64) = 13.0-1PGDG.rhel7 is needed by postgresql13-contrib-13.0-1PGDG.rhel7.x86_64
postgresql13-server(x86-64) = 13.0-1PGDG.rhel7 is needed by postgresql13-contrib-13.0-1PGDG.rhel7.x86_64
[root@rac5 Desktop]#
[root@rac5 Desktop]# rpm -ivh postgresql13-13.0-1PGDG.rhel7.x86_64.rpm
warning: postgresql13-13.0-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:postgresql13-13.0-1PGDG.rhel7 ################################# [100%]
[root@rac5 Desktop]#
[root@rac5 Desktop]#
[root@rac5 Desktop]#
[root@rac5 Desktop]#
[root@rac5 Desktop]# rpm -ivh postgresql13-contrib-13.0-1PGDG.rhel7.x86_64.rpm
warning: postgresql13-contrib-13.0-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
error: Failed dependencies:
postgresql13-server(x86-64) = 13.0-1PGDG.rhel7 is needed by postgresql13-contrib-13.0-1PGDG.rhel7.x86_64
[root@rac5 Desktop]#
[root@rac5 Desktop]#
[root@rac5 Desktop]# rpm -ivh postgresql13-server-13.0-1PGDG.rhel7.x86_64.rpm
warning: postgresql13-server-13.0-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:postgresql13-server-13.0-1PGDG.rh################################# [100%]
[root@rac5 Desktop]#
[root@rac5 Desktop]#
[root@rac5 Desktop]# rpm -ivh postgresql13-contrib-13.0-1PGDG.rhel7.x86_64.rpm
warning: postgresql13-contrib-13.0-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:postgresql13-contrib-13.0-1PGDG.r################################# [100%]
[root@rac5 Desktop]#
drwxr-xr-x. 2 root root 4096 Apr 11 2018 etc
drwxr-xr-x. 12 root root 4096 Aug 3 2019 local
lrwxrwxrwx. 1 root root 10 Aug 3 2019 tmp -> ../var/tmp
drwxr-xr-x. 4 root root 4096 Aug 3 2019 src
drwxr-xr-x. 9 root root 4096 Aug 3 2019 include
dr-xr-xr-x. 43 root root 4096 Aug 3 2019 lib
drwxr-xr-x. 46 root root 12288 Aug 3 2019 libexec
drwxr-xr-x. 241 root root 12288 Aug 3 2019 share
dr-xr-xr-x. 2 root root 20480 Aug 3 2019 sbin
dr-xr-xr-x. 144 root root 81920 Aug 3 2019 lib64
drwxr-xr-x. 5 root root 4096 Oct 27 01:51 pgsql-14
dr-xr-xr-x. 2 root root 53248 Oct 27 02:06 bin
drwxr-xr-x. 6 root root 4096 Oct 27 02:06 pgsql-13
[root@rac5 usr]# cd pgsql-13
[root@rac5 pgsql-13]#
[root@rac5 pgsql-13]# ls -lrt
total 16
drwxr-xr-x. 3 root root 4096 Oct 27 02:06 doc
drwxr-xr-x. 8 root root 4096 Oct 27 02:06 share
drwxr-xr-x. 2 root root 4096 Oct 27 02:06 bin
drwxr-xr-x. 3 root root 4096 Oct 27 02:06 lib
[root@rac5 pgsql-13]#
[root@rac5 pgsql-13]#
[root@rac5 pgsql-13]# cd bin
[root@rac5 bin]# ls -lrt
total 11092
-rwxr-xr-x. 1 root root 9622 Sep 23 02:55 postgresql-13-setup
-rwxr-xr-x. 1 root root 2175 Sep 23 02:55 postgresql-13-check-db-dir
-rwxr-xr-x. 1 root root 41696 Sep 23 02:55 vacuumlo
-rwxr-xr-x. 1 root root 80256 Sep 23 02:55 vacuumdb
-rwxr-xr-x. 1 root root 76000 Sep 23 02:55 reindexdb
-rwxr-xr-x. 1 root root 644216 Sep 23 02:55 psql
-rwxr-xr-x. 1 root root 7765904 Sep 23 02:55 postgres
-rwxr-xr-x. 1 root root 100608 Sep 23 02:55 pg_waldump
-rwxr-xr-x. 1 root root 92552 Sep 23 02:55 pg_verifybackup
-rwxr-xr-x. 1 root root 146856 Sep 23 02:55 pg_upgrade
-rwxr-xr-x. 1 root root 37296 Sep 23 02:55 pg_test_timing
-rwxr-xr-x. 1 root root 45816 Sep 23 02:55 pg_test_fsync
-rwxr-xr-x. 1 root root 37104 Sep 23 02:55 pg_standby
-rwxr-xr-x. 1 root root 126160 Sep 23 02:55 pg_rewind
-rwxr-xr-x. 1 root root 180456 Sep 23 02:55 pg_restore
-rwxr-xr-x. 1 root root 66800 Sep 23 02:55 pg_resetwal
-rwxr-xr-x. 1 root root 84584 Sep 23 02:55 pg_recvlogical
-rwxr-xr-x. 1 root root 80368 Sep 23 02:55 pg_receivewal
-rwxr-xr-x. 1 root root 67192 Sep 23 02:55 pg_isready
-rwxr-xr-x. 1 root root 105608 Sep 23 02:55 pg_dumpall
-rwxr-xr-x. 1 root root 413592 Sep 23 02:55 pg_dump
-rwxr-xr-x. 1 root root 71120 Sep 23 02:55 pg_ctl
-rwxr-xr-x. 1 root root 58072 Sep 23 02:55 pg_controldata
-rwxr-xr-x. 1 root root 41264 Sep 23 02:55 pg_config
-rwxr-xr-x. 1 root root 62584 Sep 23 02:55 pg_checksums
-rwxr-xr-x. 1 root root 155808 Sep 23 02:55 pgbench
-rwxr-xr-x. 1 root root 118488 Sep 23 02:55 pg_basebackup
-rwxr-xr-x. 1 root root 41464 Sep 23 02:55 pg_archivecleanup
-rwxr-xr-x. 1 root root 41960 Sep 23 02:55 oid2name
-rwxr-xr-x. 1 root root 130464 Sep 23 02:55 initdb
-rwxr-xr-x. 1 root root 67216 Sep 23 02:55 dropuser
-rwxr-xr-x. 1 root root 67272 Sep 23 02:55 dropdb
-rwxr-xr-x. 1 root root 71936 Sep 23 02:55 createuser
-rwxr-xr-x. 1 root root 75728 Sep 23 02:55 createdb
-rwxr-xr-x. 1 root root 71576 Sep 23 02:55 clusterdb
lrwxrwxrwx. 1 root root 8 Oct 27 02:06 postmaster -> postgres
[root@rac5 bin]# pwd
/usr/pgsql-13/bin
Step 3. Now create a Linux OS user to
access the postgres database and create data directory for
initializing database cluster. Owner of this data directory should be postgres
user and permissions should be 700 and also set path for postgresql binaries
for our ease.
# useradd postgres
# passwd postgres
# mkdir -p /u01/data_13
# chown -R postgres. /u01/data_13
Step 4. Initialize the postgres cluster
as user postgres.
-bash-4.2$ id
uid=26(postgres) gid=26(postgres) groups=26(postgres)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
-bash-4.2$
-bash-4.2$
-bash-4.2$ /usr/pgsql-13/bin/initdb
-D /u01/data_13
Step 5. Startup the new cluster as user
postgres
-bash-4.2$ /usr/pgsql-13/bin/pg_ctl -D /u01/data_13 -l
logfile start
waiting for server to start.... done
server started
Step 6. Crosscheck at OS level PostgreSQL
running or not
-bash-4.2$
ps -ef | grep postgres
postgres 23335 23334 0 02:08 pts/1 00:00:00 -bash
postgres 23507 1 0 02:13 ? 00:00:00 /usr/pgsql-13/bin/postgres -D /u01/data_13
postgres 23508 23507 0 02:13 ? 00:00:00 postgres: logger
postgres 23510 23507 0 02:13 ? 00:00:00 postgres: checkpointer
postgres 23511 23507 0 02:13 ? 00:00:00 postgres: background writer
postgres 23512 23507 0 02:13 ? 00:00:00 postgres: walwriter
postgres 23513 23507 0 02:13 ? 00:00:00 postgres: autovacuum launcher
postgres 23514 23507 0 02:13 ? 00:00:00 postgres: stats collector
postgres 23515 23507 0 02:13 ? 00:00:00 postgres: logical replication launcher
postgres 23516 23335 0 02:13 pts/1 00:00:00 ps -ef
postgres 23517 23335 0 02:13 pts/1 00:00:00 grep --color=auto postgres
Step 7. Connect to PostgreSQL DB
-bash-4.2$
psql
psql
(13.0)
Type
"help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)
No comments:
Post a Comment