Document Type | Technical Information
Category | Installation
Applicable Product Version | OpenSQL (PostgreSQL) 14.2
Document Number | OINTI001
Overview
This guide summarizes the installation procedure for the OpenSQL (PostgreSQL) DBMS based on a test environment.
It includes pre-installation preparations and step-by-step installation tasks confirmed through the actual installation process, and is intended for reference when building OpenSQL for the first time in a test environment.
Test Environment
- DB: OpenSQL (PostgreSQL) 14.2
- OS: CentOS 7.7
Configuration Information
| Primary Server | 192.168.41.220 |
|---|---|
| Standby Server | 192.168.41.221 |
| Postgresql Port | 5432 |
| Pcp Port | 9898 |
| Watchdog Port | 9000 |
| Watchdogheartbeat Port | 9694 |
Method
Installation Test
- Pre-installation Checklist
1) Minimum Installation Requirements
โข CPU core: 1 Core
โข Memory: 300MB
โข Disk: 750MB
2) Required Packages
โข GNU Make 3.80 or higher
โข Compiler: gcc recommended
โข Compression package: tar
โข Compression library (pg_dump, pg_restore): zlib
โข Command-line SQL interpreter: readline
โข Non-English message display: gettext
โข Extension modules: libxslt, libicu
โข Git / Libperl 5.8.3 or higher
โข OpenSQL team guide package:
# yum install -y make gcc gcc-c++ tar zlib zlib-devel readline readline-devel gettext gettext-devel git libxslt libicu
# yum install -y perl perl-libs tcl python python-devel openssl openssl-devel
3) Optional Packages
โข libperl 5.8.3 or higher
โข PL/tcl: tcl 8.4 or higher
โข PL/Python: python 2.7 or higher, python 3 supported
โข Encrypted client connection: openssl, openssl-devel
โข Authentication related: Kerberos, OpenLDAP, PAM
โป If you need to install extensions such as gis / pgaudit, the libperl package must be installed
4) Disable Firewall and Set SELinux to 0
โข For smooth test installation, disable the firewall: systemctl stop firewalld / systemctl disable firewalld
โข SELINUX DISABLED: Edit SELINUX=disabled in vi /etc/sysconfig/selinux
2. OpenSQL (Postgresql) Installation
1) Install the Provided RPM (โป The installation RPM can be provided by the OpenSQL team.)
โข After uploading the installation file to the test environment VM, perform the following installation steps as the root account.
โข Installation version: Postgresql-14.2
โข When installing the RPM, you must install in the following order.
โถ [Account to execute: root] # pwd /binary/PostgreSQL_v1_package_rhel7/postgresql-14 # unzip PostgreSQL_v1_package_rhel7.zip # cd /sql/PostgreSQL_v1_package_rhel7/postgresql-14 # rpm -ivh postgresql14-libs-14.2-1PGDG.rhel7.x86_64.rpm # rpm -ivh postgresql14-14.2-1PGDG.rhel7.x86_64.rpm # rpm -ivh postgresql14-server-14.2-1PGDG.rhel7.x86_64.rpm # rpm -ivh postgresql14-contrib-14.2-1PGDG.rhel7.x86_64.rpm Alternatively, you can automatically install without a specific order using yum install โy *.rpm, and you can check the installed information with yum list installed | grep postgresql.
โป Package Description
|
2) Create User and Directory
โข User: Create opensql (create user as requested by customer)
โข Required directories must be created manually
โถ [Account to execute: root] # groupadd opensql -g 1008 # useradd opensql -u 1008 -g opensql -c 'OpenSQL Database' -d /opensql # passwd opensql (set password as user prefers) # echo โd /run/opensql 0755 opensql opensql -โ > /usr/lib/tmpfiles.d/opensql.conf This command prevents the directory under /var/run from being deleted as it is volatile
โถ [Account to execute: opensql] # mkdir -p /opensql/pg/14/data # mkdir -p /opensql/pg/14/log/pg_log # mkdir -p /opensql/pg/14/pg_wal # mkdir -p /opensql/pg/14/archive # mkdir -p /var/run/opensql # chown -R opensql:opensql/opensql # chown -R opensql:opensql/var/run/opensql
โป Directory Description:
|
3) Set .bash_profile
โถ [Account to execute: opensql] # vi ~/.bash_profile ###OpenSQL-PostgreSQL ENV PS1="[\u@\h:\W]$ " export PGVERSION=14 if [ -f "/usr/pgsql-$PGVERSION/bin/pg_ctl" ]; then export PGINST=/usr/pgsql-$PGVERSION export MANPATH=/usr/pgsql-$PGVERSION/share/man:$MANPATH export LD_LIBRARY_PATH=/usr/pgsql-$PGVERSION/lib:$LD_LIBRARY_PATH export PATH=/usr/pgsql-$PGVERSION/bin:$PATH export PGLIB=/usr/pgsql-$PGVERSION/lib fi export PGHOME=/opensql/pg export PGDATA=/opensql/pg/$PGVERSION/data export PGHOST=/var/run/opensql export PGUSER=postgres
###OpenSQL-PostgreSQL ALIAS alias pginst="cd $PGINST" alias pglib="cd $PGLIB" alias pghome="cd $PGHOME" alias pgdata="cd $PGDATA" alias pglog="cd $PGHOME/$PGVERSION/log/pg_log" alias pgwal="cd $PGHOME/$PGVERSION/pg_wal" alias pgconf="vi $PGDATA/postgresql.conf" alias pghba="vi $PGDATA/pg_hba.conf" |
4) Create postgresql database cluster
โข Use the initdb command to configure postgresql environment and generate basic files.
โถ [Account to execute: opensql] -- Syntax: initdb [options...][-U] superuser name [-D] directory [-X] wal file location # initdb -U postgres -D $PGDATA -X $PGHOME/$PGVERSION/pg_wal
โป Option Description
|
5) Add postgresql.conf Settings
โถ [Account to execute: opensql] # vi $PGDATA/postgresql.conf - Add at the end listen_addresses = '*' port = 5432 unix_socket_directories = '/var/run/opensql' logging_collector = on log_directory = '/opensql/pg/14/log/pg_log' log_filename = 'postgresql-%Y-%m-%d-%H%M%S.log' log_rotation_age = 0 log_rotation_size = 100MB wal_log_hints = on archive_mode = on archive_command = 'test ! -f /opensql/pg/14/archive/%f && cp %p /opensql/pg/14/archive/%f' |
6) pg_hba.conf Settings (Set to allow all access for redundancy and access testing)
โถ [Account to execute: opensql] # vi $PGDATA/pg_hba.conf -- Add at the end # TYPE DATABASE USER ADDRESS METHOD host all all 0.0.0.0/0 trust
โป Field Value Description:
|
7) Start / Stop
โข pg_ctl command ;
- start: Start database server
- stop: Stop database server
- restart: Restart database server
- reload: Apply modified configuration file to server
- status: Display server status
[User to execute: opensql] # pg_ctl start -- Start # pg_ctl stop -- Stop -- How to change master account password: alter role postgres password โopensqlโ; |
Note
- OpenSQL (PostgreSQL) DBMS currently supports up to PostgreSQL version 15.
- The installation test included in this document is based on a record of past version installation tests installed at customer sites.
- The installation binaries can be provided separately through the OpenSQL team.