설치 파일 다운로드
https://www.postgresql.org/ftp/source
# useradd postgres
# su - postgres
$ tar -xf postgresql-13.3.tar.gz
$ cd postgresql-13.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
==========================================================
$ cd /home/postgres/pgsql/bin
$ ./initdb -D /home/postgres/pgsql/data
$ ./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
$ vi ~/.bash_profile
export LD_LIBRARY_PATH=:$HOME/pgsql/lib
export PATH=$PATH:$HOME/pgsql/bin
export PGDATA=$HOME/pgsql/data
$ source ~/.bash_profile
$ psql
psql (13.3)
Type "help" for help.
postgres=#