Tag Archives: postgresql without internet

Install PostgreSQL 17 using RPM Packages (Offline Method)

Install PostgreSQL 17 on Linux 9 Using RPM Packages (Offline Method)

Table of Contents



0. Download and Check Required Dependencies

*** Download PostgreSQL server RPM packages **** 
https://yum.postgresql.org/rpmchart/

https://download.postgresql.org/pub/repos/yum/17/redhat/rhel-9.6-x86_64/

[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 ~]#

*** Check dependency List ***

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 ~]#

*** This gives you the exact official dependency list from the RPM itself ***

rpm -qpR postgresql17-libs-17.6-1PGDG.rhel9.x86_64.rpm
rpm -qpR postgresql17-17.6-1PGDG.rhel9.x86_64.rpm
rpm -qpR postgresql17-server-17.6-1PGDG.rhel9.x86_64.rpm
rpm -qpR postgresql17-contrib-17.6-1PGDG.rhel9.x86_64.rpm

q = query
p = package file (local file)
R = Requirements (dependencies)

****To Check What is Already Installed vs Missing*****

rpm -qpR postgresql17-libs-17.6-1PGDG.rhel9.x86_64.rpm \
postgresql17-17.6-1PGDG.rhel9.x86_64.rpm \
postgresql17-server-17.6-1PGDG.rhel9.x86_64.rpm \
postgresql17-contrib-17.6-1PGDG.rhel9.x86_64.rpm 2>/dev/null | grep "^lib" | sort -u | while read dep; do
rpm -q --whatprovides "$dep" &>/dev/null && echo "INSTALLED : $dep" || echo "MISSING : $dep"
done

[root@pgdb02 ~]# rpm -qpR postgresql17-libs-17.6-1PGDG.rhel9.x86_64.rpm \
postgresql17-17.6-1PGDG.rhel9.x86_64.rpm \
postgresql17-server-17.6-1PGDG.rhel9.x86_64.rpm \
postgresql17-contrib-17.6-1PGDG.rhel9.x86_64.rpm 2>/dev/null | grep "^lib" | sort -u | while read dep; do
rpm -q --whatprovides "$dep" &>/dev/null && echo "INSTALLED : $dep" || echo "MISSING : $dep"
done
INSTALLED : libcrypto.so.3()(64bit)
INSTALLED : libcrypto.so.3(OPENSSL_3.0.0)(64bit)
INSTALLED : libc.so.6()(64bit)
INSTALLED : libc.so.6(GLIBC_2.10)(64bit)
INSTALLED : libc.so.6(GLIBC_2.11)(64bit)
INSTALLED : libc.so.6(GLIBC_2.14)(64bit)
INSTALLED : libc.so.6(GLIBC_2.15)(64bit)
INSTALLED : libc.so.6(GLIBC_2.17)(64bit)
INSTALLED : libc.so.6(GLIBC_2.2.5)(64bit)
INSTALLED : libc.so.6(GLIBC_2.25)(64bit)
INSTALLED : libc.so.6(GLIBC_2.27)(64bit)
INSTALLED : libc.so.6(GLIBC_2.3.2)(64bit)
INSTALLED : libc.so.6(GLIBC_2.32)(64bit)
INSTALLED : libc.so.6(GLIBC_2.33)(64bit)
INSTALLED : libc.so.6(GLIBC_2.3.4)(64bit)
INSTALLED : libc.so.6(GLIBC_2.34)(64bit)
INSTALLED : libc.so.6(GLIBC_2.3)(64bit)
INSTALLED : libc.so.6(GLIBC_2.4)(64bit)
INSTALLED : libc.so.6(GLIBC_2.6)(64bit)
INSTALLED : libc.so.6(GLIBC_2.7)(64bit)
INSTALLED : libc.so.6(GLIBC_2.9)(64bit)
INSTALLED : libecpg.so.6()(64bit)
INSTALLED : libgssapi_krb5.so.2()(64bit)
INSTALLED : libgssapi_krb5.so.2(gssapi_krb5_2_MIT)(64bit)
INSTALLED : libicu
INSTALLED : libicudata.so.67()(64bit)
INSTALLED : libicui18n.so.67()(64bit)
INSTALLED : libicuuc.so.67()(64bit)
INSTALLED : libldap.so.2()(64bit)
INSTALLED : libldap.so.2(OPENLDAP_2.200)(64bit)
INSTALLED : liblz4.so.1()(64bit)
INSTALLED : libm.so.6()(64bit)
INSTALLED : libm.so.6(GLIBC_2.2.5)(64bit)
INSTALLED : libm.so.6(GLIBC_2.29)(64bit)
INSTALLED : libpam.so.0()(64bit)
INSTALLED : libpam.so.0(LIBPAM_1.0)(64bit)
INSTALLED : libperl.so.5.32()(64bit)
INSTALLED : libpgtypes.so.3()(64bit)
INSTALLED : libpq.so.5()(64bit)
INSTALLED : libpython3.9.so.1.0()(64bit)
INSTALLED : libreadline.so.8()(64bit)
INSTALLED : libselinux.so.1()(64bit)
INSTALLED : libselinux.so.1(LIBSELINUX_1.0)(64bit)
INSTALLED : libssl.so.3()(64bit)
INSTALLED : libssl.so.3(OPENSSL_3.0.0)(64bit)
INSTALLED : libsystemd.so.0()(64bit)
INSTALLED : libsystemd.so.0(LIBSYSTEMD_209)(64bit)
INSTALLED : libuuid.so.1()(64bit)
INSTALLED : libuuid.so.1(UUID_1.0)(64bit)
INSTALLED : libxml2.so.2()(64bit)
INSTALLED : libxml2.so.2(LIBXML2_2.4.30)(64bit)
INSTALLED : libxml2.so.2(LIBXML2_2.6.0)(64bit)
INSTALLED : libxml2.so.2(LIBXML2_2.6.23)(64bit)
INSTALLED : libxml2.so.2(LIBXML2_2.6.5)(64bit)
INSTALLED : libxml2.so.2(LIBXML2_2.6.8)(64bit)
INSTALLED : libxslt.so.1()(64bit)
INSTALLED : libxslt.so.1(LIBXML2_1.0.11)(64bit)
INSTALLED : libxslt.so.1(LIBXML2_1.0.18)(64bit)
INSTALLED : libxslt.so.1(LIBXML2_1.0.22)(64bit)
INSTALLED : libz.so.1()(64bit)
MISSING : libzstd >= 1.4.0  <---  is a REQUIREMENT defined by PostgreSQL RPM — not something libzstd declares.
INSTALLED : libzstd.so.1()(64bit)
[root@pgdb02 ~]#

*** libzstd library is installed BUT the version is NEWER than 1.4.0, It's fine. Verify manually to confirm. (Script error) ****

[root@pgdb02 ~]# rpm -q libzstd
libzstd-1.5.5-1.el9.x86_64  <--- It's 1.5.5
[root@pgdb02 ~]#

[root@pgdb02 ~]# rpm -q --provides libzstd
libzstd = 1.5.5-1.el9
libzstd(x86-64) = 1.5.5-1.el9
libzstd.so.1()(64bit)
[root@pgdb02 ~]#

1. Verify Downloaded RPM Packages

[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 ~]#

# Always install in this order:
rpm -ivh postgresql17-libs-17.6-1PGDG.rhel9.x86_64.rpm    # 1st - Shared library files (Foundation)
rpm -ivh postgresql17-17.6-1PGDG.rhel9.x86_64.rpm         # 2nd - Client tools
rpm -ivh postgresql17-server-17.6-1PGDG.rhel9.x86_64.rpm  # 3rd - Server
rpm -ivh postgresql17-contrib-17.6-1PGDG.rhel9.x86_64.rpm # 4th - Extensions

The postgresql17-server RPM is the core package required to host and run a PostgreSQL 17 database instance. It contains the database engine, background services, and utilities needed to initialize and manage a database cluster.
i = Install
v = Verbose (show me what's happening)
h = Hashes (show progress bar)
PartMeaning
17PostgreSQL Major version — 17
17.6Minor version — 17.6 (6th patch of version 17)
1RPM Build number — built 1 time
PGDGPostgreSQL Global Development Group — official PostgreSQL community repo, not Red Hat
rhel9Built for RHEL 9 / Oracle Linux 9
x86_6464-bit Intel or AMD processor

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

# Add below entries .bash_profile or custom profile and then reload profile

export PGHOME=/usr/pgsql-17
export PGDATA=/pgData/pgsql17/data
export PATH=$PGHOME/bin:$PATH

# reload 
[postgres@pgdb02 ~]$ . .bash_profile
[postgres@pgdb02 ~]$
[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 ~]$

10. Enable PostgreSQL service at boot (Automatic Restart at boot)

Issue: Failed to start "systemctl start postgresql-17"

[root@pgdb02 ~]# tail -f /var/log/messages
..
..
Jun 18 20:07:55 lxceftsgvdb01 systemd[1]: Starting PostgreSQL 17 database server...
Jun 18 20:07:55 lxceftsgvdb01 postgresql-17-check-db-dir[3641]: "/var/lib/pgsql/17/data/" is missing or empty.
Jun 18 20:07:55 lxceftsgvdb01 postgresql-17-check-db-dir[3641]: Use "/usr/pgsql-17/bin/postgresql-17-setup initdb" to initialize the database cluster.
Jun 18 20:07:55 lxceftsgvdb01 postgresql-17-check-db-dir[3641]: See /usr/share/doc/postgresql17/README.rpm-dist for more information.
Jun 18 20:07:55 lxceftsgvdb01 systemd[1]: postgresql-17.service: Control process exited, code=exited, status=1/FAILURE
Jun 18 20:07:55 lxceftsgvdb01 systemd[1]: postgresql-17.service: Failed with result 'exit-code'.
Jun 18 20:07:55 lxceftsgvdb01 systemd[1]: Failed to start PostgreSQL 17 database server.

# Verify postgresql-17.service
[postgres@pgdb02 ~]$ cat /usr/lib/systemd/system/postgresql-17.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades.  It is recommended to use systemd
# "dropin" feature;  i.e. create file with suffix .conf under
# /etc/systemd/system/postgresql-17.service.d directory overriding the
# unit's defaults. You can also use "systemctl edit postgresql-17"
# Look at systemd.unit(5) manual page for more info.

# Note: changing PGDATA will typically require adjusting SELinux
# configuration as well.

# Note: do not use a PGDATA pathname containing spaces, or you will
# break postgresql-17-setup.
[Unit]
Description=PostgreSQL 17 database server
Documentation=https://www.postgresql.org/docs/17/static/
After=syslog.target
After=network-online.target

[Service]
Type=notify

User=postgres
Group=postgres

# Note: avoid inserting whitespace in these Environment= lines, or you may
# break postgresql-setup.

# Location of database directory
Environment=PGDATA=/var/lib/pgsql/17/data/   <------ 

# Where to send early-startup messages from the server (before the logging
# options of postgresql.conf take effect)
# This is normally controlled by the global default set by systemd
# StandardOutput=syslog

# Disable OOM kill on postgres main process
OOMScoreAdjust=-1000
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
Environment=PG_OOM_ADJUST_VALUE=0

ExecStartPre=/usr/pgsql-17/bin/postgresql-17-check-db-dir ${PGDATA}
ExecStart=/usr/pgsql-17/bin/postgres -D ${PGDATA}
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT

# Do not set any timeout value, so that systemd will not kill postgres
# main process during crash recovery.
TimeoutSec=0

# 0 is the same as infinity, but "infinity" needs systemd 229
TimeoutStartSec=0

TimeoutStopSec=1h

[Install]
WantedBy=multi-user.target
[postgres@pgdb02 ~]$


1. Stop PostgreSQL as Postgres user using pg_ctl if running
# As postgres user
[postgres@pgdb02 ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
[postgres@pgdb02 ~]$

2. Set DATA Directory location as root user
# As root user
[root@pgdb02  ~]# grep -i Environment=PGDATA /usr/lib/systemd/system/postgresql-17.service
Environment=PGDATA=/var/lib/pgsql/17/data/   <--- set to wrong location, need to correct this. 
[root@pgdb02  ~]#
[root@pgdb02  ~]# sed -i 's|Environment=PGDATA=/var/lib/pgsql/17/data/|Environment=PGDATA=/pgData/pgsql17/data/|' /usr/lib/systemd/system/postgresql-17.service
[root@pgdb02  ~]#
[root@pgdb02  ~]# grep -i Environment=PGDATA /usr/lib/systemd/system/postgresql-17.service
Environment=PGDATA=/pgData/pgsql17/data/
[root@pgdb02  ~]#

3. Enable PostgreSQL service at boot

[root@pgdb02 ~]# systemctl enable postgresql-17
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-17.service → /usr/lib/systemd/system/postgresql-17.service.
[root@pgdb02 ~]#

4. Start PostgreSQL service
[root@pgdb02 ~]# systemctl start postgresql-17
[root@pgdb02 ~]#

5. Verify Status

[root@pgdb02 ~]# systemctl status postgresql-17
● postgresql-17.service - PostgreSQL 17 database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql-17.service; enabled; preset: disabled)
     Active: active (running) since Thu 2026-06-18 20:44:47 +08; 9s ago
       Docs: https://www.postgresql.org/docs/17/static/
    Process: 3959 ExecStartPre=/usr/pgsql-17/bin/postgresql-17-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
   Main PID: 3964 (postgres)
      Tasks: 7 (limit: 15700)
     Memory: 17.6M
        CPU: 79ms
     CGroup: /system.slice/postgresql-17.service
             ├─3964 /usr/pgsql-17/bin/postgres -D /pgData/pgsql17/data/
             ├─3965 "postgres: logger "
             ├─3966 "postgres: checkpointer "
             ├─3967 "postgres: background writer "
             ├─3969 "postgres: walwriter "
             ├─3970 "postgres: autovacuum launcher "
             └─3971 "postgres: logical replication launcher "

Jun 18 20:44:47 pgdb02 systemd[1]: Starting PostgreSQL 17 database server...
Jun 18 20:44:47 pgdb02 postgres[3964]: 2026-06-18 20:44:47.663 +08 [3964] LOG:  redirecting log output to logging collector process
Jun 18 20:44:47 pgdb02 postgres[3964]: 2026-06-18 20:44:47.663 +08 [3964] HINT:  Future log output will appear in directory "log".
Jun 18 20:44:47 pgdb02 systemd[1]: Started PostgreSQL 17 database server.
[root@pgdb02 ~]#

[postgres@pgdb02 ~]$ tail -f /pgData/pgsql17/data/log/postgresql-Thu.log
..
..
2026-06-18 20:44:47.665 +08 [3964] LOG:  starting 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
2026-06-18 20:44:47.667 +08 [3964] LOG:  listening on IPv6 address "::1", port 5432
2026-06-18 20:44:47.667 +08 [3964] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2026-06-18 20:44:47.668 +08 [3964] LOG:  listening on Unix socket "/run/postgresql/.s.PGSQL.5432"
2026-06-18 20:44:47.672 +08 [3964] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2026-06-18 20:44:47.679 +08 [3968] LOG:  database system was shut down at 2026-06-18 20:44:43 +08
2026-06-18 20:44:47.688 +08 [3964] LOG:  database system is ready to accept connections

[root@pgdb02 ~]# tail -f /var/log/messages
..
..
Jun 18 20:44:47 pgdb02 systemd[1]: Starting PostgreSQL 17 database server...
Jun 18 20:44:47 pgdb02 postgres[3964]: 2026-06-18 20:44:47.663 +08 [3964] LOG:  redirecting log output to logging collector process
Jun 18 20:44:47 pgdb02 postgres[3964]: 2026-06-18 20:44:47.663 +08 [3964] HINT:  Future log output will appear in directory "log".
Jun 18 20:44:47 pgdb02 systemd[1]: Started PostgreSQL 17 database server.
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/