Install PostgreSQL 17.4 Using Source Code (Linux 9)
Table of Contents
0. Environment
| Parameter | Value |
|---|---|
| Host Name | pgdb01 |
| IP | 192.168.2.71 |
| OS | Linux 9 |
| PostgreSQL Version | 17.4 |
| Data Directory | /pgData/pgsql/17.4 |
| PG WAL | /pgWal/pgsql/17.4 |
| BIN Directory | /pgbin/pgsql/17.4/bin |
| Software Staging Directory | /pg_Backup/stage |
1. Set SELINUX to Permissive and Restart the server
# Set SELINUX to permissive
[root@pgdb02 ~]# grep ^SELINUX= /etc/selinux/config
SELINUX=enforcing
[root@pgdb02 ~]#
[root@pgdb02 ~]# sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config
[root@pgdb02 ~]#
[root@pgdb02 ~]# grep ^SELINUX= /etc/selinux/config
SELINUX=permissive
[root@pgdb02 ~]#
[root@pgdb02 ~]# shutdown -Fr now <---- Restart the server to take effect
2. Install Dependencies
**Note:** For testing purposes, I intentionally did not install the following dependency packages:Β dnf install -y perl perl-core perl-ExtUtils-MakeMakerWe can see dependency-related error to be reproduced and observed during the installation process.**Caution:** If you do not want toΒ encounter the error described in **Step 7**, install the above packages before proceeding.As part of this exercise, the installation will be cleaned up after the error is encountered, and the installation process will then be repeated with the required dependencies installed to demonstrate a successful installation.[root@pgdb01 ~]# dnf install -y readline-devel zlib-devel gcc make libicu-devel openssl-devel bison flex wget tar
Last metadata expiration check: 0:08:12 ago on Tue 21 Apr 2026 07:35:12 PM.
Package wget-1.21.1-8.el9_4.x86_64 is already installed.
Package tar-2:1.34-7.el9.x86_64 is already installed.
Dependencies resolved.
==============================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================
Installing:
bison x86_64 3.7.4-5.el9 ol9_appstream 1.0 M
..
..
Verifying : cpp-11.5.0-5.0.1.el9.x86_64 43/43
Upgraded:
cpp-11.5.0-11.0.2.el9.x86_64 glibc-2.34-231.0.1.el9_7.10.x86_64 glibc-all-langpacks-2.34-231.0.1.el9_7.10.x86_64 glibc-common-2.34-231.0.1.el9_7.10.x86_64
glibc-gconv-extra-2.34-231.0.1.el9_7.10.x86_64 glibc-langpack-en-2.34-231.0.1.el9_7.10.x86_64 libgcc-11.5.0-11.0.2.el9.x86_64 libgomp-11.5.0-11.0.2.el9.x86_64
libicu-67.1-10.el9_6.x86_64 openssl-1:3.5.1-7.0.1.el9_7.x86_64 openssl-fips-provider-3.0.7-8.0.1.el9.x86_64 openssl-fips-provider-so-3.0.7-8.0.1.el9.x86_64
openssl-libs-1:3.5.1-7.0.1.el9_7.x86_64 tar-2:1.34-9.el9_7.x86_64
Installed:
bison-3.7.4-5.el9.x86_64 flex-2.6.4-9.el9.x86_64 gcc-11.5.0-11.0.2.el9.x86_64 glibc-devel-2.34-231.0.1.el9_7.10.x86_64
glibc-headers-2.34-231.0.1.el9_7.10.x86_64 kernel-headers-5.14.0-611.47.1.el9_7.x86_64 libicu-devel-67.1-10.el9_6.x86_64 libxcrypt-devel-4.4.18-3.el9.x86_64
m4-1.4.19-1.el9.x86_64 make-1:4.3-8.el9.x86_64 ncurses-c++-libs-6.2-10.20210508.el9.x86_64 ncurses-devel-6.2-10.20210508.el9.x86_64
openssl-devel-1:3.5.1-7.0.1.el9_7.x86_64 readline-devel-8.1-4.el9.x86_64 zlib-devel-1.2.11-40.el9.x86_64
Complete!
[root@pgdb01 ~]#
3. Create postgres User
[root@pgdb01 ~]# useradd postgres
[root@pgdb01 ~]# passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@pgdb01 ~]#
4. Download PostgreSQL Source
[root@pgdb01 ~]# mkdir -p /pg_Backup/stage
[root@pgdb01 ~]# cd /pg_Backup/stage
[root@pgdb01 stage]# wget https://ftp.postgresql.org/pub/source/v17.4/postgresql-17.4.tar.gz
--2026-04-21 20:22:48-- https://ftp.postgresql.org/pub/source/v17.4/postgresql-17.4.tar.gz
Resolving ftp.postgresql.org (ftp.postgresql.org)... 151.101.211.52, 2a04:4e42:31::820
Connecting to ftp.postgresql.org (ftp.postgresql.org)|151.101.211.52|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 28056622 (27M) [application/gzip]
Saving to: βpostgresql-17.4.tar.gzβ
postgresql-17.4.tar.gz 100%[=================================================================================================================>] 26.76M 10.2MB/s in 2.6s
2026-04-21 20:22:51 (10.2 MB/s) - βpostgresql-17.4.tar.gzβ saved [28056622/28056622]
[root@pgdb01 stage]#
5. Extract Source
[root@pgdb01 stage]# tar -xvf postgresql-17.4.tar.gz
postgresql-17.4/
postgresql-17.4/.cirrus.star
postgresql-17.4/.cirrus.tasks.yml
..
..
postgresql-17.4/src/tutorial/funcs.source
postgresql-17.4/src/tutorial/syscat.source
[root@pgdb01 stage]#
[root@pgdb01 stage]# ls -ltr
total 27404
drwxrwxr-x. 6 root root 4096 Feb 18 2025 postgresql-17.4
-rw-r--r--. 1 root root 28056622 Feb 18 2025 postgresql-17.4.tar.gz
[root@pgdb01 stage]# cd postgresql-17.4
[root@pgdb01 postgresql-17.4]# pwd
/pg_Backup/stage/postgresql-17.4
[root@pgdb01 postgresql-17.4]#
6. Configure Build
| Command | What it does | Result |
|---|---|---|
./configure --prefix= |
| Nothing is compiled or installed yet. |
make | Compiles the source code into binaries (postgres, psql, pg_ctl, etc.) inside the source directory. | Nothing is installed yet. |
make install | Copies the compiled binaries, libraries, headers and share files into the prefix directory.(/pgbin/pgsql/17.4) | Needs write permission on the prefix directory (create the directory first). |
[root@pgdb01 postgresql-17.4]# ls -ltr /pg_Backup/stage/postgresql-17.4/configure
-rwxrwxr-x. 1 root root 580836 Feb 18 2025 /pg_Backup/stage/postgresql-17.4/configure
[root@pgdb01 postgresql-17.4]#
Configure do only:
-- checks system dependencies
-- prepares Makefiles
-- stores your install path (/pgbin/pgsql/17.4) internally, it won't create bin directory.
-- It does NOT install anything yet
[root@pgdb01 postgresql-17.4]# ./configure --prefix=/pgbin/pgsql/17.4 --with-pgport=5432
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking which template to use... linux
checking whether NLS is wanted... no <----- it will NOT cause any issue. PostgreSQL build will work perfectly fine (English only, Not for non-English languages)
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... none needed
checking for g++... no
checking for c++... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking for gawk... gawk
checking whether gcc supports -Wdeclaration-after-statement, for CFLAGS... yes
checking whether gcc supports -Werror=vla, for CFLAGS... yes
checking whether gcc supports -Werror=unguarded-availability-new, for CFLAGS... no
checking whether g++ supports -Werror=unguarded-availability-new, for CXXFLAGS... no
checking whether gcc supports -Wendif-labels, for CFLAGS... yes
checking whether g++ supports -Wendif-labels, for CXXFLAGS... no
checking whether gcc supports -Wmissing-format-attribute, for CFLAGS... yes
checking whether g++ supports -Wmissing-format-attribute, for CXXFLAGS... no
checking whether gcc supports -Wimplicit-fallthrough=3, for CFLAGS... yes
checking whether g++ supports -Wimplicit-fallthrough=3, for CXXFLAGS... no
checking whether gcc supports -Wcast-function-type, for CFLAGS... yes
checking whether g++ supports -Wcast-function-type, for CXXFLAGS... no
checking whether gcc supports -Wshadow=compatible-local, for CFLAGS... yes
checking whether g++ supports -Wshadow=compatible-local, for CXXFLAGS... no
checking whether gcc supports -Wformat-security, for CFLAGS... yes
checking whether g++ supports -Wformat-security, for CXXFLAGS... no
checking whether gcc supports -fno-strict-aliasing, for CFLAGS... yes
checking whether g++ supports -fno-strict-aliasing, for CXXFLAGS... no
checking whether gcc supports -fwrapv, for CFLAGS... yes
checking whether g++ supports -fwrapv, for CXXFLAGS... no
checking whether gcc supports -fexcess-precision=standard, for CFLAGS... yes
checking whether g++ supports -fexcess-precision=standard, for CXXFLAGS... no
checking whether gcc supports -funroll-loops, for CFLAGS_UNROLL_LOOPS... yes
checking whether gcc supports -ftree-vectorize, for CFLAGS_VECTORIZE... yes
checking whether gcc supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... no
checking whether gcc supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... no
checking whether gcc supports -Wformat-truncation, for NOT_THE_CFLAGS... yes
checking whether gcc supports -Wstringop-truncation, for NOT_THE_CFLAGS... yes
checking whether gcc supports -Wcast-function-type-strict, for NOT_THE_CFLAGS... no
checking whether gcc supports -fvisibility=hidden, for CFLAGS_SL_MODULE... yes
checking whether g++ supports -fvisibility=hidden, for CXXFLAGS_SL_MODULE... no
checking whether g++ supports -fvisibility-inlines-hidden, for CXXFLAGS_SL_MODULE... no
checking whether the C compiler still works... yes
checking how to run the C preprocessor... gcc -E
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether to build with ICU support... yes
checking for icu-uc icu-i18n... yes
checking whether to build with Tcl... no
checking whether to build Perl modules... no
checking whether to build Python modules... no
checking whether to build with GSSAPI support... no
checking whether to build with PAM support... no
checking whether to build with BSD Authentication support... no
checking whether to build with LDAP support... no
checking whether to build with Bonjour support... no
checking whether to build with SELinux support... no
checking whether to build with systemd support... no
checking whether to build with XML support... no
checking whether to build with LZ4 support... no
checking whether to build with ZSTD support... no
checking for strip... strip
checking whether it is possible to strip libraries... yes
checking for ar... ar
checking for a BSD-compatible install... /usr/bin/install -c
checking for tar... /usr/bin/tar
checking whether ln -s works... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for bison... /usr/bin/bison
configure: using bison (GNU Bison) 3.7.4
checking for flex... /usr/bin/flex
configure: using flex 2.6.4
checking for perl... /usr/bin/perl
configure: using perl 5.32.1
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for strerror_r... yes
checking whether strerror_r returns int... no
checking for main in -lm... yes
checking for library containing setproctitle... no
checking for library containing dlsym... none required
checking for library containing socket... none required
checking for library containing getopt_long... none required
checking for library containing shm_open... none required
checking for library containing shm_unlink... none required
checking for library containing clock_gettime... none required
checking for library containing shmget... none required
checking for library containing backtrace_symbols... none required
checking for library containing pthread_barrier_wait... none required
checking for library containing readline... -lreadline
checking for inflate in -lz... yes
checking atomic.h usability... no
checking atomic.h presence... no
checking for atomic.h... no
checking copyfile.h usability... no
checking copyfile.h presence... no
checking for copyfile.h... no
checking execinfo.h usability... yes
checking execinfo.h presence... yes
checking for execinfo.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking ifaddrs.h usability... yes
checking ifaddrs.h presence... yes
checking for ifaddrs.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking mbarrier.h usability... no
checking mbarrier.h presence... no
checking for mbarrier.h... no
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking sys/event.h usability... no
checking sys/event.h presence... no
checking for sys/event.h... no
checking sys/personality.h usability... yes
checking sys/personality.h presence... yes
checking for sys/personality.h... yes
checking sys/prctl.h usability... yes
checking sys/prctl.h presence... yes
checking for sys/prctl.h... yes
checking sys/procctl.h usability... no
checking sys/procctl.h presence... no
checking for sys/procctl.h... no
checking sys/signalfd.h usability... yes
checking sys/signalfd.h presence... yes
checking for sys/signalfd.h... yes
checking sys/ucred.h usability... no
checking sys/ucred.h presence... no
checking for sys/ucred.h... no
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking ucred.h usability... no
checking ucred.h presence... no
checking for ucred.h... no
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for lz4... no
checking for zstd... no
checking for openssl... /usr/bin/openssl
configure: using openssl: OpenSSL 3.5.1 1 Jul 2025 (Library: OpenSSL 3.5.1 1 Jul 2025)
checking whether byte ordering is bigendian... no
checking for inline... inline
checking for printf format archetype... gnu_printf
checking for _Static_assert... yes
checking for typeof... typeof
checking for __builtin_types_compatible_p... yes
checking for __builtin_constant_p... yes
checking for __builtin_unreachable... yes
checking for computed goto support... yes
checking for struct tm.tm_zone... yes
checking for union semun... no
checking for socklen_t... yes
checking for struct sockaddr.sa_len... no
checking for locale_t... yes
checking for C/C++ restrict keyword... __restrict
checking for struct option... yes
checking whether assembler supports x86_64 popcntq... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking size of off_t... 8
checking size of bool... 1
checking for int timezone... yes
checking for wcstombs_l declaration... no
checking for backtrace_symbols... yes
checking for copyfile... no
checking for copy_file_range... yes
checking for getifaddrs... yes
checking for getpeerucred... no
checking for inet_pton... yes
checking for kqueue... no
checking for mbstowcs_l... no
checking for memset_s... no
checking for posix_fallocate... yes
checking for ppoll... yes
checking for pthread_is_threaded_np... no
checking for setproctitle... no
checking for setproctitle_fast... no
checking for strchrnul... yes
checking for strsignal... yes
checking for syncfs... yes
checking for sync_file_range... yes
checking for uselocale... yes
checking for wcstombs_l... no
checking for __builtin_bswap16... yes
checking for __builtin_bswap32... yes
checking for __builtin_bswap64... yes
checking for __builtin_clz... yes
checking for __builtin_ctz... yes
checking for __builtin_popcount... yes
checking for __builtin_frame_address... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking how gcc reports undeclared, standard C functions... error
checking for posix_fadvise... yes
checking whether posix_fadvise is declared... yes
checking whether fdatasync is declared... yes
checking whether strlcat is declared... no
checking whether strlcpy is declared... no
checking whether strnlen is declared... yes
checking whether preadv is declared... yes
checking whether pwritev is declared... yes
checking whether F_FULLFSYNC is declared... no
checking for explicit_bzero... yes
checking for getopt... yes
checking for getpeereid... no
checking for inet_aton... yes
checking for mkdtemp... yes
checking for strlcat... no
checking for strlcpy... no
checking for strnlen... yes
checking for pthread_barrier_wait... yes
checking for getopt_long... yes
checking for syslog... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for opterr... yes
checking for optreset... no
checking unicode/ucol.h usability... yes
checking unicode/ucol.h presence... yes
checking for unicode/ucol.h... yes
checking for rl_completion_suppress_quote... yes
checking for rl_filename_quote_characters... yes
checking for rl_filename_quoting_function... yes
checking for append_history... yes
checking for history_truncate_file... yes
checking for rl_completion_matches... yes
checking for rl_filename_completion_function... yes
checking for rl_reset_screen_size... yes
checking for rl_variable_bind... yes
checking test program... ok
checking whether long int is 64 bits... yes
checking for __builtin_mul_overflow... yes
checking size of void *... 8
checking size of size_t... 8
checking size of long... 8
checking alignment of short... 2
checking alignment of int... 4
checking alignment of long... 8
checking alignment of double... 8
checking for int8... no
checking for uint8... no
checking for int64... no
checking for uint64... no
checking for __int128... yes
checking for __int128 alignment bug... ok
checking alignment of PG_INT128_TYPE... 16
checking for builtin __sync char locking functions... yes
checking for builtin __sync int32 locking functions... yes
checking for builtin __sync int32 atomic operations... yes
checking for builtin __sync int64 atomic operations... yes
checking for builtin __atomic int32 atomic operations... yes
checking for builtin __atomic int64 atomic operations... yes
checking for __get_cpuid... yes
checking for __get_cpuid_count... yes
checking for __cpuid... no
checking for __cpuidex... no
checking for _xgetbv with CFLAGS=... no
checking for _xgetbv with CFLAGS=-mxsave... yes
checking for _mm512_popcnt_epi64 with CFLAGS=... no
checking for _mm512_popcnt_epi64 with CFLAGS=-mavx512vpopcntdq -mavx512bw... yes
checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=... yes
checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=... no
checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc+simd... no
checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc... no
checking for __builtin_loongarch_crcc_w_b_w, __builtin_loongarch_crcc_w_h_w, __builtin_loongarch_crcc_w_w_w and __builtin_loongarch_crcc_w_d_w... no
checking which CRC-32C implementation to use... SSE 4.2
checking for library containing sem_init... none required
checking which semaphore API to use... unnamed POSIX
checking which random number source to use... /dev/urandom
checking for /dev/urandom... yes
checking for xmllint... /usr/bin/xmllint
checking for xsltproc... /usr/bin/xsltproc
checking for fop... no
checking for dbtoepub... no
checking whether gcc supports -Wl,--as-needed, for LDFLAGS... yes
checking whether gcc supports -Wl,--export-dynamic, for LDFLAGS_EX_BE... yes
configure: using compiler=gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-11.0.2)
configure: using CFLAGS=-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2
configure: using CPPFLAGS= -D_GNU_SOURCE
configure: using LDFLAGS= -Wl,--as-needed
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/include/pg_config_ext.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking src/backend/port/posix_sema.c to src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port
[root@pgdb01 postgresql-17.4]#
[root@pgdb01 postgresql-17.4]# tail -1 config.log
configure: exit 0 <--------------------------- 0 = SUCCESS , Any number other than 0 = FAILED
[root@pgdb01 postgresql-17.4]#
7. Compile Source
A Makefile is a special text configuration file used by the make build automation tool to automatically compile and link C programs. Instead of manually typing long gcc compilation commands every time you modify your code, a Makefile lets you build your entire project by simply typing make into your terminal. make compiles source code into executable binary files, while make install copies those compiled files into your system directories so the program can be run from anywhere. [root@pgdb01 postgresql-17.4]# which make
/usr/bin/make
[root@pgdb01 postgresql-17.4]#
[root@pgdb01 postgresql-17.4]# ls -ltr Makefile
-rw-rw-r--. 1 root root 1822 Feb 18 2025 Makefile
[root@pgdb01 postgresql-17.4]#
[root@pgdb01 postgresql-17.4]# make
make -C ./src/backend generated-headers
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/backend'
make -C ../include/catalog generated-headers
make[2]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/include/catalog'
'/usr/bin/perl' ../../../src/backend/catalog/genbki.pl --include-path=../../../src/include/ \
--set-version=17 ../../../src/include/catalog/pg_proc.h ../../../src/include/catalog/pg_type.h ../../../src/include/catalog/pg_attribute.h ../../../src/include/catalog/pg_class.h ../../../src/include/catalog/pg_attrdef.h ../../../src/include/catalog/pg_constraint.h ../../../src/include/catalog/pg_inherits.h ../../../src/include/catalog/pg_index.h ../../../src/include/catalog/pg_operator.h ../../../src/include/catalog/pg_opfamily.h ../../../src/include/catalog/pg_opclass.h ../../../src/include/catalog/pg_am.h ../../../src/include/catalog/pg_amop.h ../../../src/include/catalog/pg_amproc.h ../../../src/include/catalog/pg_language.h ../../../src/include/catalog/pg_largeobject_metadata.h ../../../src/include/catalog/pg_largeobject.h ../../../src/include/catalog/pg_aggregate.h ../../../src/include/catalog/pg_statistic.h ../../../src/include/catalog/pg_statistic_ext.h ../../../src/include/catalog/pg_statistic_ext_data.h ../../../src/include/catalog/pg_rewrite.h ../../../src/include/catalog/pg_trigger.h ../../../src/include/catalog/pg_event_trigger.h ../../../src/include/catalog/pg_description.h ../../../src/include/catalog/pg_cast.h ../../../src/include/catalog/pg_enum.h ../../../src/include/catalog/pg_namespace.h ../../../src/include/catalog/pg_conversion.h ../../../src/include/catalog/pg_depend.h ../../../src/include/catalog/pg_database.h ../../../src/include/catalog/pg_db_role_setting.h ../../../src/include/catalog/pg_tablespace.h ../../../src/include/catalog/pg_authid.h ../../../src/include/catalog/pg_auth_members.h ../../../src/include/catalog/pg_shdepend.h ../../../src/include/catalog/pg_shdescription.h ../../../src/include/catalog/pg_ts_config.h ../../../src/include/catalog/pg_ts_config_map.h ../../../src/include/catalog/pg_ts_dict.h ../../../src/include/catalog/pg_ts_parser.h ../../../src/include/catalog/pg_ts_template.h ../../../src/include/catalog/pg_extension.h ../../../src/include/catalog/pg_foreign_data_wrapper.h ../../../src/include/catalog/pg_foreign_server.h ../../../src/include/catalog/pg_user_mapping.h ../../../src/include/catalog/pg_foreign_table.h ../../../src/include/catalog/pg_policy.h ../../../src/include/catalog/pg_replication_origin.h ../../../src/include/catalog/pg_default_acl.h ../../../src/include/catalog/pg_init_privs.h ../../../src/include/catalog/pg_seclabel.h ../../../src/include/catalog/pg_shseclabel.h ../../../src/include/catalog/pg_collation.h ../../../src/include/catalog/pg_parameter_acl.h ../../../src/include/catalog/pg_partitioned_table.h ../../../src/include/catalog/pg_range.h ../../../src/include/catalog/pg_transform.h ../../../src/include/catalog/pg_sequence.h ../../../src/include/catalog/pg_publication.h ../../../src/include/catalog/pg_publication_namespace.h ../../../src/include/catalog/pg_publication_rel.h ../../../src/include/catalog/pg_subscription.h ../../../src/include/catalog/pg_subscription_rel.h
Can't locate FindBin.pm in @INC (you may need to install the FindBin module) (@INC contains: /usr/local/lib64/perl5/5.32 /usr/local/share/perl5/5.32 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at ../../../src/backend/catalog/genbki.pl line 20.
BEGIN failed--compilation aborted at ../../../src/backend/catalog/genbki.pl line 20.
make[2]: *** [Makefile:141: bki-stamp] Error 2
make[2]: Leaving directory '/pg_Backup/stage/postgresql-17.4/src/include/catalog'
make[1]: *** [Makefile:121: submake-catalog-headers] Error 2
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/src/backend'
make: *** [src/Makefile.global:384: submake-generated-headers] Error 2
[root@pgdb01 postgresql-17.4]#
*** The FindBin module is a core Perl library used to locate the absolute directory path of the currently executing script. It is primarily used in conjunction with the lib module to dynamically load local, relative modules without hardcoding paths. ****
[root@pgdb01 postgresql-17.4]# dnf install -y perl perl-core perl-ExtUtils-MakeMaker
Last metadata expiration check: 1:17:45 ago on Tue 21 Apr 2026 07:35:12 PM.
Dependencies resolved.
==============================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================
Installing:
perl x86_64 4:5.32.1-481.1.el9_6 ol9_appstream 11 k
perl-ExtUtils-MakeMaker noarch 2:7.60-3.el9 ol9_appstream 352 k
Upgrading:
libstdc++ x86_64 11.5.0-11.0.2.el9 ol9_baseos_latest 757 k
..
..
Complete!
[root@pgdb01 postgresql-17.4]#
[root@pgdb01 postgresql-17.4]# make clean <--- Cleanup due to error out
make -C doc clean
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/doc'
make -C src clean
..
..
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/config'
make[1]: Nothing to be done for 'clean'.
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/config'
rm -rf tmp_install/ portlock/
[root@pgdb01 postgresql-17.4]#
# Rerun make command
[root@pgdb01 postgresql-17.4]# make
make -C ./src/backend generated-headers
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/backend'
make -C ../include/catalog generated-headers
make[2]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/include/catalog'
..
..
port -L../../../src/common -Wl,--as-needed -Wl,-rpath,'/pgbin/pgsql/17.4/lib',--enable-new-dtags -lpgcommon -lpgport -lz -lreadline -lm -o pg_isolation_regress
make[2]: Leaving directory '/pg_Backup/stage/postgresql-17.4/src/test/isolation'
make -C test/perl all
make[2]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/test/perl'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/pg_Backup/stage/postgresql-17.4/src/test/perl'
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/src'
make -C config all
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/config'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/config'
[root@pgdb01 postgresql-17.4]#
8. Install PostgreSQL
# Bin directory /pgbin/pgsql/17.4/ will get created by make install command.
[root@pgdb01 postgresql-17.4]# make install
make -C ./src/backend generated-headers
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/backend'
make -C ../include/catalog generated-headers
..
..
make -C config install
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/config'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/lib/pgxs/config'
/usr/bin/install -c -m 755 ./install-sh '/pgbin/pgsql/17.4/lib/pgxs/config/install-sh'
/usr/bin/install -c -m 755 ./missing '/pgbin/pgsql/17.4/lib/pgxs/config/missing'
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/config'
[root@pgdb01 postgresql-17.4]#
[root@pgdb01 postgresql-17.4]# cd /pgbin/pgsql/17.4/
[root@pgdb01 17.4]# ll
total 16
drwxr-xr-x. 2 root root 4096 Apr 21 21:06 bin
drwxr-xr-x. 6 root root 4096 Apr 21 21:06 include
drwxr-xr-x. 4 root root 4096 Apr 21 21:06 lib
drwxr-xr-x. 6 root root 4096 Apr 21 21:06 share
[root@pgdb01 17.4]#
9. Install PostgreSQL Contrib for extensions
#Install Contrib
cd /pg_Backup/stage/postgresql-17.4
make -C contrib install
--- OR ----
cd /pg_Backup/stage/postgresql-17.4/contrib
make
make install
[root@pgdb01 ~]# cd /pg_Backup/stage/postgresql-17.4/contrib
[root@pgdb01 contrib]# make
..
..
make -C vacuumlo all
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/contrib/vacuumlo'
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -I../../src/interfaces/libpq -I. -I. -I../../src/include -D_GNU_SOURCE -c -o vacuumlo.o vacuumlo.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 vacuumlo.o -L../../src/interfaces/libpq -lpq -L../../src/port -L../../src/common -Wl,--as-needed -Wl,-rpath,'/pgbin/pgsql/17.4/lib',--enable-new-dtags -lpgcommon -lpgport -lz -lreadline -lm -o vacuumlo
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/contrib/vacuumlo'
[root@pgdb01 contrib]#
[root@pgdb01 contrib]# make install
..
..
make -C unaccent install
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/contrib/unaccent'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/lib'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/share/extension'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/share/extension'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/share/tsearch_data'
/usr/bin/install -c -m 755 unaccent.so '/pgbin/pgsql/17.4/lib/unaccent.so'
/usr/bin/install -c -m 644 ./unaccent.control '/pgbin/pgsql/17.4/share/extension/'
/usr/bin/install -c -m 644 ./unaccent--1.1.sql ./unaccent--1.0--1.1.sql '/pgbin/pgsql/17.4/share/extension/'
/usr/bin/install -c -m 644 ./unaccent.rules '/pgbin/pgsql/17.4/share/tsearch_data/'
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/contrib/unaccent'
make -C vacuumlo install
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/contrib/vacuumlo'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/bin'
/usr/bin/install -c vacuumlo '/pgbin/pgsql/17.4/bin'
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/contrib/vacuumlo'
[root@pgdb01 contrib]#
[root@pgdb01 contrib]# ls /pgbin/pgsql/17.4/share/extension
amcheck--1.0--1.1.sql citext.control hstore--1.5--1.6.sql pageinspect--1.10--1.11.sql pgrowlocks.control pg_visibility--1.0--1.1.sql
amcheck--1.0.sql cube--1.0--1.1.sql hstore--1.6--1.7.sql pageinspect--1.11--1.12.sql pg_stat_statements--1.0--1.1.sql pg_visibility--1.1--1.2.sql
amcheck--1.1--1.2.sql cube--1.1--1.2.sql hstore--1.7--1.8.sql pageinspect--1.1--1.2.sql pg_stat_statements--1.10--1.11.sql pg_visibility--1.1.sql
amcheck--1.2--1.3.sql cube--1.2--1.3.sql hstore.control pageinspect--1.2--1.3.sql pg_stat_statements--1.1--1.2.sql pg_visibility.control
amcheck--1.3--1.4.sql cube--1.2.sql insert_username--1.0.sql pageinspect--1.3--1.4.sql pg_stat_statements--1.2--1.3.sql pg_walinspect--1.0--1.1.sql
amcheck.control cube--1.3--1.4.sql insert_username.control pageinspect--1.4--1.5.sql pg_stat_statements--1.3--1.4.sql pg_walinspect--1.0.sql
autoinc--1.0.sql cube--1.4--1.5.sql intagg--1.0--1.1.sql pageinspect--1.5--1.6.sql pg_stat_statements--1.4--1.5.sql pg_walinspect.control
autoinc.control cube.control intagg--1.1.sql pageinspect--1.5.sql pg_stat_statements--1.4.sql plpgsql--1.0.sql
bloom--1.0.sql dblink--1.0--1.1.sql intagg.control pageinspect--1.6--1.7.sql pg_stat_statements--1.5--1.6.sql plpgsql.control
bloom.control dblink--1.1--1.2.sql intarray--1.0--1.1.sql pageinspect--1.7--1.8.sql pg_stat_statements--1.6--1.7.sql postgres_fdw--1.0--1.1.sql
btree_gin--1.0--1.1.sql dblink--1.2.sql intarray--1.1--1.2.sql pageinspect--1.8--1.9.sql pg_stat_statements--1.7--1.8.sql postgres_fdw--1.0.sql
btree_gin--1.0.sql dblink.control intarray--1.2--1.3.sql pageinspect--1.9--1.10.sql pg_stat_statements--1.8--1.9.sql postgres_fdw.control
btree_gin--1.1--1.2.sql dict_int--1.0.sql intarray--1.2.sql pageinspect.control pg_stat_statements--1.9--1.10.sql refint--1.0.sql
btree_gin--1.2--1.3.sql dict_int.control intarray--1.3--1.4.sql pg_buffercache--1.0--1.1.sql pg_stat_statements.control refint.control
btree_gin.control dict_xsyn--1.0.sql intarray--1.4--1.5.sql pg_buffercache--1.1--1.2.sql pgstattuple--1.0--1.1.sql seg--1.0--1.1.sql
btree_gist--1.0--1.1.sql dict_xsyn.control intarray.control pg_buffercache--1.2--1.3.sql pgstattuple--1.1--1.2.sql seg--1.1--1.2.sql
btree_gist--1.1--1.2.sql earthdistance--1.0--1.1.sql isn--1.0--1.1.sql pg_buffercache--1.2.sql pgstattuple--1.2--1.3.sql seg--1.1.sql
btree_gist--1.2--1.3.sql earthdistance--1.1--1.2.sql isn--1.1--1.2.sql pg_buffercache--1.3--1.4.sql pgstattuple--1.3--1.4.sql seg--1.2--1.3.sql
btree_gist--1.2.sql earthdistance--1.1.sql isn--1.1.sql pg_buffercache--1.4--1.5.sql pgstattuple--1.4--1.5.sql seg--1.3--1.4.sql
btree_gist--1.3--1.4.sql earthdistance.control isn.control pg_buffercache.control pgstattuple--1.4.sql seg.control
btree_gist--1.4--1.5.sql file_fdw--1.0.sql lo--1.0--1.1.sql pg_freespacemap--1.0--1.1.sql pgstattuple.control tablefunc--1.0.sql
btree_gist--1.5--1.6.sql file_fdw.control lo--1.1.sql pg_freespacemap--1.1--1.2.sql pg_surgery--1.0.sql tablefunc.control
btree_gist--1.6--1.7.sql fuzzystrmatch--1.0--1.1.sql lo.control pg_freespacemap--1.1.sql pg_surgery.control tcn--1.0.sql
btree_gist.control fuzzystrmatch--1.1--1.2.sql ltree--1.0--1.1.sql pg_freespacemap.control pg_trgm--1.0--1.1.sql tcn.control
citext--1.0--1.1.sql fuzzystrmatch--1.1.sql ltree--1.1--1.2.sql pg_prewarm--1.0--1.1.sql pg_trgm--1.1--1.2.sql tsm_system_rows--1.0.sql
citext--1.1--1.2.sql fuzzystrmatch.control ltree--1.1.sql pg_prewarm--1.1--1.2.sql pg_trgm--1.2--1.3.sql tsm_system_rows.control
citext--1.2--1.3.sql hstore--1.1--1.2.sql ltree--1.2--1.3.sql pg_prewarm--1.1.sql pg_trgm--1.3--1.4.sql tsm_system_time--1.0.sql
citext--1.3--1.4.sql hstore--1.2--1.3.sql ltree.control pg_prewarm.control pg_trgm--1.3.sql tsm_system_time.control
citext--1.4--1.5.sql hstore--1.3--1.4.sql moddatetime--1.0.sql pgrowlocks--1.0--1.1.sql pg_trgm--1.4--1.5.sql unaccent--1.0--1.1.sql
citext--1.4.sql hstore--1.4--1.5.sql moddatetime.control pgrowlocks--1.1--1.2.sql pg_trgm--1.5--1.6.sql unaccent--1.1.sql
citext--1.5--1.6.sql hstore--1.4.sql pageinspect--1.0--1.1.sql pgrowlocks--1.2.sql pg_trgm.control unaccent.control
[root@pgdb01 contrib]#
[root@pgdb01 contrib]# cd
[root@pgdb01 ~]# chown -R postgres:postgres /pgbin /pgData /pgWal /pgArch /pg_Backup
[root@pgdb01 ~]# chmod 700 /pgbin /pgData /pgWal /pgArch /pg_Backup
[root@pgdb01 ~]#
10. Set Environment Variables (As Postgres user)
# Switch to postgres user:
[root@pgdb01 17.4]# su - postgres
[postgres@pgdb01 ~]$
# Add below lines to .bash_profile and reload profile
export PGHOME=/pgbin/pgsql/17.4
export PATH=$PGHOME/bin:$PATH
export PGDATA=/pgData/pgsql/17.4
[postgres@pgdb01 ~]$ . .bash_profile
[postgres@pgdb01 ~]$
[postgres@pgdb01 ~]$ which psql
/pgbin/pgsql/17.4/bin/psql
[postgres@pgdb01 ~]$
11. Validation 1 (As Postgres user)
[postgres@pgdb01 ~]$ /pgbin/pgsql/17.4/bin/pg_config
BINDIR = /pgbin/pgsql/17.4/bin
DOCDIR = /pgbin/pgsql/17.4/share/doc
HTMLDIR = /pgbin/pgsql/17.4/share/doc
INCLUDEDIR = /pgbin/pgsql/17.4/include
PKGINCLUDEDIR = /pgbin/pgsql/17.4/include
INCLUDEDIR-SERVER = /pgbin/pgsql/17.4/include/server
LIBDIR = /pgbin/pgsql/17.4/lib
PKGLIBDIR = /pgbin/pgsql/17.4/lib
LOCALEDIR = /pgbin/pgsql/17.4/share/locale
MANDIR = /pgbin/pgsql/17.4/share/man
SHAREDIR = /pgbin/pgsql/17.4/share
SYSCONFDIR = /pgbin/pgsql/17.4/etc
PGXS = /pgbin/pgsql/17.4/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--prefix=/pgbin/pgsql/17.4' '--with-pgport=5432'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2
CFLAGS_SL = -fPIC
LDFLAGS = -Wl,--as-needed -Wl,-rpath,'/pgbin/pgsql/17.4/lib',--enable-new-dtags
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lz -lreadline -lm
VERSION = PostgreSQL 17.4
[postgres@pgdb01 ~]$
12. Initialize Database (As Postgres user)
# Read more about initdb
https://www.br8dba.com/initdb-postgresql-cluster-initialization/
[postgres@pgdb01 ~]$ mkdir -p /pgData/pgsql/17.4 /pgWal/pgsql/17.4
[postgres@pgdb01 ~]$
[postgres@pgdb01 ~]$ /pgbin/pgsql/17.4/bin/initdb --pgdata=/pgData/pgsql/17.4 --waldir=/pgWal/pgsql/17.4 --wal-segsize=128
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/pgsql/17.4 ... ok
fixing permissions on existing directory /pgWal/pgsql/17.4 ... 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:
/pgbin/pgsql/17.4/bin/pg_ctl -D /pgData/pgsql/17.4 -l logfile start
[postgres@pgdb01 ~]$
13. Start Postgres Instance(As Postgres user)
[postgres@pgdb01 ~]$ /pgbin/pgsql/17.4/bin/pg_ctl -D /pgData/pgsql/17.4 -l logfile start
waiting for server to start.... done
server started
[postgres@pgdb01 ~]$
14. Validation (As Postgres user)
[postgres@pgdb01 ~]$ ps -ef | grep postgres
root 62627 3156 0 21:40 pts/0 00:00:00 su - postgres
postgres 62628 62627 0 21:40 pts/0 00:00:00 -bash
postgres 62707 1 0 21:50 ? 00:00:00 /pgbin/pgsql/17.4/bin/postgres -D /pgData/pgsql/17.4
postgres 62708 62707 0 21:50 ? 00:00:00 postgres: checkpointer
postgres 62709 62707 0 21:50 ? 00:00:00 postgres: background writer
postgres 62711 62707 0 21:50 ? 00:00:00 postgres: walwriter
postgres 62712 62707 0 21:50 ? 00:00:00 postgres: autovacuum launcher
postgres 62713 62707 0 21:50 ? 00:00:00 postgres: logical replication launcher
postgres 62715 62628 99 21:52 pts/0 00:00:00 ps -ef
postgres 62716 62628 0 21:52 pts/0 00:00:00 grep --color=auto postgres
[postgres@pgdb01 ~]$
[postgres@pgdb01 ~]$ psql -c "SELECT VERSION();"
version
---------------------------------------------------------------------------------------------------------------
PostgreSQL 17.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-11.0.2), 64-bit
(1 row)
[postgres@pgdb01 ~]$
[postgres@pgdb01 ~]$ psql
psql (17.4)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | Locale | ICU Rules | Access privileges
-----------+----------+----------+-----------------+-------------+-------------+--------+-----------+-----------------------
postgres | postgres | UTF8 | libc | en_SG.UTF-8 | en_SG.UTF-8 | | |
template0 | postgres | UTF8 | libc | en_SG.UTF-8 | en_SG.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | en_SG.UTF-8 | en_SG.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(3 rows)
postgres=# \du
List of roles
Role name | Attributes
-----------+------------------------------------------------------------
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS
postgres=#
postgres=# \q
[postgres@pgdb01 ~]$
15. Create systemctl service for PostgreSQL (as root user) - OptionalΒ
# As root user
cat > /etc/systemd/system/postgresql-17.service <<'EOF'
[Unit]
Description=PostgreSQL 17 Database Server
Documentation=https://www.postgresql.org/docs/17/
After=network.target
[Service]
Type=forking
User=postgres
Group=postgres
# PostgreSQL Data Directory
Environment=PGDATA=/pgData/pgsql/17.4
# Start PostgreSQL
ExecStart=/pgbin/pgsql/17.4/bin/pg_ctl start -D ${PGDATA} -l ${PGDATA}/logfile
# Stop PostgreSQL
ExecStop=/pgbin/pgsql/17.4/bin/pg_ctl stop -D ${PGDATA} -m fast
# Reload PostgreSQL
ExecReload=/pgbin/pgsql/17.4/bin/pg_ctl reload -D ${PGDATA}
Restart=always
RestartSec=5
TimeoutSec=300
[Install]
WantedBy=multi-user.target
EOF# 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 ~]$
# As root user
# Enable PostgreSQL service at boot
[root@pgdb02 ~]# systemctl enable postgresql-17
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-17.service β /etc/systemd/system/postgresql-17.service.
[root@pgdb02 ~]#
# As root user
# Start PostgreSQL service
[root@pgdb02 ~]# systemctl start postgresql-17
[root@pgdb02 ~]#
# As root user
# Verify Status
[root@pgdb02 ~]# systemctl status postgresql-17
β postgresql-17.service - PostgreSQL 17 Database Server
Loaded: loaded (/etc/systemd/system/postgresql-17.service; enabled; preset: disabled)
Active: active (running) since Sat 2026-06-20 16:08:44 +08; 16s ago
Docs: https://www.postgresql.org/docs/17/
Process: 3302 ExecStart=/pgbin/pgsql/17.4/bin/pg_ctl start -D ${PGDATA} -l ${PGDATA}/logfile (code=exited, status=0/SUCCESS)
Main PID: 3305 (postgres)
Tasks: 6 (limit: 15700)
Memory: 21.4M
CPU: 77ms
CGroup: /system.slice/postgresql-17.service
ββ3305 /pgbin/pgsql/17.4/bin/postgres -D /pgData/pgsql/17.4
ββ3306 "postgres: checkpointer "
ββ3307 "postgres: background writer "
ββ3310 "postgres: walwriter "
ββ3311 "postgres: autovacuum launcher "
ββ3312 "postgres: logical replication launcher "
Jun 20 16:08:43 pgdb02 systemd[1]: Starting PostgreSQL 17 Database Server...
Jun 20 16:08:44 pgdb02 pg_ctl[3302]: waiting for server to start.... done
Jun 20 16:08:44 pgdb02 pg_ctl[3302]: server started
Jun 20 16:08:44 pgdb02 systemd[1]: Started PostgreSQL 17 Database Server.
[root@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