PostgreSQL 13 설치

JM·2021년 7월 26일
0

PostgreSQL

목록 보기
1/2

PostgreSQL 13 소스 설치

설치 파일 다운로드
https://www.postgresql.org/ftp/source

설치 환경

  • OS : CentOS Linux release 7.9.2009 (Core)
  • DB : PostgreSQL 13.3

설치 방법

1. 계정 생성

# useradd postgres
# su - postgres

2. 설치 파일 압축 해제

$ tar -xf postgresql-13.3.tar.gz
$ cd postgresql-13.3

3. 엔진 설치

$ ./configure --prefix=/home/postgres/pgsql
$ make && make install

==========================================================
-- prefix 옵션은 엔진 설치 경로이며, 기본값은 '/usr/local/pgsql'
-- configure 과정에서 에러 발생 시 아래 패키지 설치 후 재 실행

configure: error: no acceptable C compiler found in $PATH
=> $ sudo yum install gcc

configure: error: readline library not found
=> $ sudo yum install readline-devel

configure: error: zlib library not found
=> $ sudo yum install zlib-devel
==========================================================

4. 데이터베이스 클러스터 초기화

$ cd /home/postgres/pgsql/bin
$ ./initdb -D /home/postgres/pgsql/data

5. PostgreSQL Start / Stop / Restart

$ ./pg_ctl -D /home/postgres/pgsql/data start
 waiting for server to start....
 server started

$ ./pg_ctl -D /home/postgres/pgsql/data stop
 waiting for server to shut down....
 server stopped

$ ./pg_ctl -D /home/postgres/pgsql/data restart
 waiting for server to shut down....
 server stopped
 waiting for server to start....
 server started

6. PATH 설정

$ vi ~/.bash_profile
 export LD_LIBRARY_PATH=:$HOME/pgsql/lib
 export PATH=$PATH:$HOME/pgsql/bin
 export PGDATA=$HOME/pgsql/data

$ source ~/.bash_profile

7. PostgreSQL 접속

$ psql
psql (13.3)
Type "help" for help.

postgres=# 
profile
오픈소스 DB엔지니어

0개의 댓글