Install PostgreSQL 17 on Linux 9 Using RPM Packages (Offline Method)
Table of Contents
0. Check Required Dependencies
root@pgdb02 ~]# rpm -qa | grep -E "libicu|openssl|readline|zlib"
zlib-1.2.11-40.el9.x86_64
libicu-67.1-9.el9.x86_64
readline-8.1-4.el9.x86_64
openssl-fips-provider-so-3.0.7-6.0.1.el9_5.x86_64
openssl-fips-provider-3.0.7-6.0.1.el9_5.x86_64
openssl-libs-3.2.2-6.0.1.el9_5.1.x86_64
openssl-3.2.2-6.0.1.el9_5.1.x86_64
xmlsec1-openssl-1.2.29-13.el9.x86_64
[root@pgdb02 ~]#
1. Verify Downloaded RPM Packages
*** Download the postgres server rpms ****
https://yum.postgresql.org/rpmchart/
[root@pgdb02 ~]# ls -ltr *.rpm
-rw-r--r--. 1 root root 1991253 Jun 4 19:24 postgresql17-17.6-1PGDG.rhel9.x86_64.rpm
-rw-r--r--. 1 root root 7265750 Jun 4 19:24 postgresql17-server-17.6-1PGDG.rhel9.x86_64.rpm
-rw-r--r--. 1 root root 349311 Jun 4 19:24 postgresql17-libs-17.6-1PGDG.rhel9.x86_64.rpm
-rw-r--r--. 1 root root 747670 Jun 4 19:24 postgresql17-contrib-17.6-1PGDG.rhel9.x86_64.rpm
[root@pgdb02 ~]#
2. Install PostgreSQL Libraries Package
[root@pgdb02 ~]# rpm -ivh postgresql17-libs-17.6-1PGDG.rhel9.x86_64.rpm
warning: postgresql17-libs-17.6-1PGDG.rhel9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 08b40d20: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:postgresql17-libs-17.6-1PGDG.rhel################################# [100%]
[root@pgdb02 ~]#
3. Install PostgreSQL Client Package
[root@pgdb02 ~]# rpm -ivh postgresql17-17.6-1PGDG.rhel9.x86_64.rpm
warning: postgresql17-17.6-1PGDG.rhel9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 08b40d20: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:postgresql17-17.6-1PGDG.rhel9 ################################# [100%]
[root@pgdb02 ~]#
[root@pgdb02 ~]# psql --version
psql (PostgreSQL) 17.6
[root@pgdb02 ~]#
4. Install PostgreSQL Server Package
[root@pgdb02 ~]# rpm -ivh postgresql17-server-17.6-1PGDG.rhel9.x86_64.rpm
warning: postgresql17-server-17.6-1PGDG.rhel9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 08b40d20: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:postgresql17-server-17.6-1PGDG.rh################################# [100%]
[root@pgdb02 ~]#
[root@pgdb02 ~]# id postgres
uid=26(postgres) gid=26(postgres) groups=26(postgres)
[root@pgdb02 ~]#
5. Install PostgreSQL Contrib Package (Optional but Recommended)
[root@pgdb02 ~]# rpm -ivh postgresql17-contrib-17.6-1PGDG.rhel9.x86_64.rpm
warning: postgresql17-contrib-17.6-1PGDG.rhel9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 08b40d20: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:postgresql17-contrib-17.6-1PGDG.r################################# [100%]
[root@pgdb02 ~]#
6. Verify Installed Packages
[root@pgdb02 ~]# rpm -qa | grep postgresql17
postgresql17-libs-17.6-1PGDG.rhel9.x86_64
postgresql17-17.6-1PGDG.rhel9.x86_64
postgresql17-server-17.6-1PGDG.rhel9.x86_64
postgresql17-contrib-17.6-1PGDG.rhel9.x86_64
[root@pgdb02 ~]#
7. Initialize PostgreSQL Database Cluster
[root@pgdb02 ~]# mkdir -p /pgData/pgsql17/data
[root@pgdb02 ~]# chown -R postgres:postgres /pgData
[root@pgdb02 ~]#
[root@pgdb02 ~]# mkdir -p /pgWal/pgsql17/wal
[root@pgdb02 ~]# chown -R postgres:postgres /pgWal
[root@pgdb02 ~]#
[root@pgdb02 ~]# su - postgres
[postgres@pgdb02 ~]$
[postgres@pgdb02 ~]$ /usr/pgsql-17/bin/initdb -D /pgData/pgsql17/data -X /pgWal/pgsql17/wal --wal-segsize=64
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_SG.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /pgData/pgsql17/data ... ok
fixing permissions on existing directory /pgWal/pgsql17/wal ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default "max_connections" ... 100
selecting default "shared_buffers" ... 128MB
selecting default time zone ... Asia/Singapore
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/usr/pgsql-17/bin/pg_ctl -D /pgData/pgsql17/data -l logfile start
[postgres@pgdb02 ~]$
8. Start PostgreSQL Service
[postgres@pgdb02 ~]$ id postgres
uid=26(postgres) gid=26(postgres) groups=26(postgres)
[postgres@pgdb02 ~]$
[postgres@pgdb02 ~]$ /usr/pgsql-17/bin/pg_ctl -D /pgData/pgsql17/data -l /pgData/pgsql17/data/postgresql.log start
waiting for server to start.... done
server started
[postgres@pgdb02 ~]$
[postgres@pgdb02 ~]$ ps -ef | grep postgres
root 4366 3019 0 20:50 pts/0 00:00:00 su - postgres
postgres 4367 4366 0 20:50 pts/0 00:00:00 -bash
postgres 4559 1 0 21:32 ? 00:00:00 /usr/pgsql-17/bin/postgres -D /pgData/pgsql17/data
postgres 4560 4559 0 21:32 ? 00:00:00 postgres: logger
postgres 4561 4559 0 21:32 ? 00:00:00 postgres: checkpointer
postgres 4562 4559 0 21:32 ? 00:00:00 postgres: background writer
postgres 4564 4559 0 21:32 ? 00:00:00 postgres: walwriter
postgres 4565 4559 0 21:32 ? 00:00:00 postgres: autovacuum launcher
postgres 4566 4559 0 21:32 ? 00:00:00 postgres: logical replication launcher
postgres 4568 4367 0 21:33 pts/0 00:00:00 ps -ef
postgres 4569 4367 0 21:33 pts/0 00:00:00 grep --color=auto postgres
[postgres@pgdb02 ~]$
[postgres@pgdb02 ~]$ pstree -p 4559
postgres(4559)─┬─postgres(4560) ----- postgres: logger
├─postgres(4561) ----- postgres: checkpointer
├─postgres(4562) ----- postgres: background writer
├─postgres(4564) ----- postgres: walwriter
├─postgres(4565) ----- postgres: autovacuum launcher
└─postgres(4566) ----- postgres: logical replication launcher
[postgres@pgdb02 ~]$
[postgres@pgdb02 ~]$ ls -ltr /pgData/pgsql17/data
total 72
lrwxrwxrwx. 1 postgres postgres 18 Jun 4 21:31 pg_wal -> /pgWal/pgsql17/wal
drwx------. 2 postgres postgres 6 Jun 4 21:31 pg_twophase
drwx------. 2 postgres postgres 6 Jun 4 21:31 pg_snapshots
drwx------. 2 postgres postgres 6 Jun 4 21:31 pg_serial
drwx------. 2 postgres postgres 6 Jun 4 21:31 pg_replslot
drwx------. 2 postgres postgres 6 Jun 4 21:31 pg_notify
drwx------. 4 postgres postgres 36 Jun 4 21:31 pg_multixact
drwx------. 2 postgres postgres 6 Jun 4 21:31 pg_dynshmem
drwx------. 2 postgres postgres 6 Jun 4 21:31 pg_commit_ts
drwx------. 2 postgres postgres 6 Jun 4 21:31 pg_tblspc
drwx------. 2 postgres postgres 6 Jun 4 21:31 pg_stat_tmp
-rw-------. 1 postgres postgres 3 Jun 4 21:31 PG_VERSION
-rw-------. 1 postgres postgres 30703 Jun 4 21:31 postgresql.conf
-rw-------. 1 postgres postgres 88 Jun 4 21:31 postgresql.auto.conf
-rw-------. 1 postgres postgres 2640 Jun 4 21:31 pg_ident.conf
-rw-------. 1 postgres postgres 5711 Jun 4 21:31 pg_hba.conf
drwx------. 2 postgres postgres 18 Jun 4 21:31 pg_xact
drwx------. 2 postgres postgres 18 Jun 4 21:31 pg_subtrans
drwx------. 5 postgres postgres 33 Jun 4 21:31 base
drwx------. 4 postgres postgres 68 Jun 4 21:31 pg_logical
drwx------. 2 postgres postgres 32 Jun 4 21:32 log
-rw-------. 1 postgres postgres 185 Jun 4 21:32 postgresql.log
-rw-------. 1 postgres postgres 30 Jun 4 21:32 current_logfiles
-rw-------. 1 postgres postgres 55 Jun 4 21:32 postmaster.opts
drwx------. 2 postgres postgres 6 Jun 4 21:32 pg_stat
-rw-------. 1 postgres postgres 97 Jun 4 21:32 postmaster.pid
drwx------. 2 postgres postgres 4096 Jun 4 21:33 global
[postgres@pgdb02 ~]$
[postgres@pgdb02 ~]$ ls -l /pgWal/pgsql17/wal
total 65536
-rw-------. 1 postgres postgres 67108864 Jun 4 21:33 000000010000000000000001
drwx------. 2 postgres postgres 6 Jun 4 21:31 archive_status
drwx------. 2 postgres postgres 6 Jun 4 21:31 summaries
[postgres@pgdb02 ~]$
9. Connect to PostgreSQL Database
[postgres@pgdb02 ~]$ psql -c "SELECT version();"
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 17.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5), 64-bit
(1 row)
[postgres@pgdb02 ~]$
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
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/