PostgreSQL

[Postgresql] postgres 15 version 설치

리거니 2023. 4. 3. 17:47

 

PostgreSQL 15 Version 설치 가이드

 


공식 사이트 다운로드 : https://www.postgresql.org/download/linux/redhat/
 


 

[1]

# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm


[2]

# Install PostgreSQL:
sudo yum install -y postgresql15-server

            [rpm 종속성 에러 발생 시 ]
            yum install libicu-50.2-4.el7_7.x86_64
            yum install postgresql15-15.2-1PGDG.rhel7.x86_64
            yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
            yum install libzstd-devel


[3]


# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
sudo systemctl enable postgresql-15
sudo systemctl start postgresql-15


[4]


# Install PostgreSQL Engine:
https://www.postgresql.org/ftp/source/v14.6/


            tar.gz 풀고
            1. configure
            2. make
            3. make install





[root@localhost postgresql-15.0]# systemctl status postgresql-15
● postgresql-15.service - PostgreSQL 15 database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql-15.service; enabled; vendor preset: disabled)
   Active: active (running) since 금 2023-03-03 13:28:52 KST; 4s ago
     Docs: https://www.postgresql.org/docs/15/static/
  Process: 12409 ExecStartPre=/usr/pgsql-15/bin/postgresql-15-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 12414 (postmaster)
   CGroup: /system.slice/postgresql-15.service
           ├─12414 /usr/pgsql-15/bin/postmaster -D /var/lib/pgsql/15/data/
           ├─12416 postgres: logger
           ├─12417 postgres: checkpointer
           ├─12418 postgres: background writer
           ├─12420 postgres: walwriter
           ├─12421 postgres: autovacuum launcher
           └─12422 postgres: logical replication launcher







[root@localhost postgresql-15.0]# cat /etc/passwd
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash

        [postgres 계정 생성확인]

drwx------.  2 postgres postgres    6  2월  9 21:25 backups
drwx------. 20 postgres postgres 4096  3월  3 13:28 data
-rw-------.  1 postgres postgres 1000  3월  3 13:23 initdb.log
-bash-4.2$ pwd
/var/lib/pgsql/15



[root@localhost postgresql-15.0]# su - postgres
-bash-4.2$ id
uid=26(postgres) gid=26(postgres) groups=26(postgres) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
-bash-4.2$ psql
psql (9.2.24, server 15.2)
WARNING: psql version 9.2, server version 15.0.
         Some psql features might not work.
Type "help" for help.

postgres=# select version();
                                                 version
---------------------------------------------------------------------------------------------------------
PostgreSQL 15.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
(1 row)




( extension dir )
[root@localhost plperl]# pwd
/root/postgresql-15.0/src/pl/plperl


( pg_stat_statements install )
https://wylee-developer.tistory.com/26

yum list *postgresql*contrib*
yum -y install postgresql[13,14]-contrib.x86_64
postgresql.conf 에서 shared_pre~~ = 'pg_stat_statements' 추가 후 재시작
create extension pg_stat_statements;