[운영 종료] TmaxTibero Tech Blog

티맥스티베로 공식 블로그는 https://tmaxtibero.blog/ 로 이전되었습니다.

티맥스티베로 공식 블로그 이전 자세히보기

인터페이스, 연동

[Tibero] DBLINK 설정_Tibero to PostgreSQL (3)

TmaxTiberotech 2023. 7. 31. 15:23

PostgreSQL 설치

1. 엔진 설치

1.1. 패키지 설치

[root@www:/root]yum -y install gcc gcc-c++ make autoconf wget readline readline-devel
zlib zlib-devel openssl openssl-devel gettext gettext-devel python python-devel

 

 

1.2. 설치 파일 업로드 및 압축 해제

아래 링크를 통해 원하는 버전을 다운로드 합니다.

 

 

Index of /pub/source/

 

ftp.postgresql.org

[root@www:/root]cd /usr/local/src
[root@www:/usr/local/src]ls -al
total 196140
drwxr-xr-x. 5 root root 4096 Nov 4 09:49 .
drwxr-xr-x. 15 root root 4096 Dec 7 2020 ..
-rw-r--r-- 1 root root 26791694 Nov 4 09:48 postgresql-12.3.tar.gz
[root@www:/usr/local/src]tar xvzf postgresql-12.3.tar.gz

 

1.3. 사용자 생성

[root@www:/usr/local/src] groupadd dba
[root@www:/usr/local/src] useradd -d /home/postgres -g dba postgres

1.4. Profile 변경

[root@www:/usr/local/src]su - postgres
[postgres@www:/home/postgres]$ vi .bash_profile
stty erase ^H
### User ENV ###
export PS1="[`whoami`@`hostname`:\$PWD]$ "
POSTGRES_HOME=/home/postgres/pgsql
PGLIB=$POSTGRES_HOME/lib
PGDATA=$POSTGRES_HOME/data
MANPATH=$MANPATH:$POSTGRES_HOME/man
PATH=$POSTGRES_HOME/bin:$PATH
export PATH
export POSTGRES_HOME
export PGLIB
export PGDATA
export MANPATH
LD_LIBRARY_PATH=/home/postgres/pgsql/lib
export LD_LIBRARY_PATH

1.5. PostgreSQL 설치

[root@www:/usr/local/src]cd postgresql-12.3
[root@www:/usr/local/src/postgresql-12.3]./configure --prefix=/home/postgres/pgsql --
enable-depend --enable-nls=ko --with-python
……
[root@www:/usr/local/src/postgresql-12.3]make && make install
……
make[1]: Leaving directory `/usr/local/src/postgresql-12.3/config'
PostgreSQL installation complete.

1.6. 데이터 디렉토리 생성

[root@www:/home/postgres]mkdir -p /home/postgres/pgsql/data
[root@www:/home/postgres]chown -R postgres:dba /home/postgres/pgsql

 

1.7. 클러스터 생성 및 기동

[root@www:/home/postgres]su - postgres
[postgres@www:/home/postgres]$ cd /home/postgres/pgsql/bin
[postgres@www:/home/postgres/pgsql/bin]$ ./initdb -E utf-8 -D
/home/postgres/pgsql/data
Success. You can now start the database server using:
    ./pg_ctl -D /home/postgres/pgsql/data -l logfile start
[postgres@www:/home/postgres]$./pg_ctl -D /home/postgres/pgsql/data -l logfile start

 

1.8. 프로세스 확인

[postgres@www:/home/postgres]$ ps -ef |grep postgres
postgres 2544 1 0 16:40 ? 00:00:00 /home/postgres/pgsql/bin/postgres -D
/home/postgres/pgsql/data
postgres 2548 2544 0 16:40 ? 00:00:00 postgres: checkpointer
postgres 2549 2544 0 16:40 ? 00:00:00 postgres: background writer
postgres 2550 2544 0 16:40 ? 00:00:00 postgres: walwriter
postgres 2551 2544 0 16:40 ? 00:00:00 postgres: autovacuum launcher
postgres 2552 2544 0 16:40 ? 00:00:00 postgres: stats collector
postgres 2553 2544 0 16:40 ? 00:00:00 postgres: logical replication launcher
postgres 2645 31461 0 16:40 pts/8 00:00:00 psql
[postgres@www:/home/postgres]$ pg_ctl status
pg_ctl: server is running (PID: 2544)
/home/postgres/pgsql/bin/postgres "-D" "/home/postgres/pgsql/data"