IT 관련/PostgreSQL

[PostgreSQL] rhel7.9 에서 PostgreSQL-15 설치하는 법

상어 우두머리 2025. 9. 11. 15:30
728x90

1. libzstd-1.5.5-1.el7.x86_64.rpm 파일 install 먼저 진행

[root@localhost tmp]# sudo yum install libzstd-1.5.5-1.el7.x86_64.rpm
Loaded plugins: product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Examining libzstd-1.5.5-1.el7.x86_64.rpm: libzstd-1.5.5-1.el7.x86_64
Marking libzstd-1.5.5-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package libzstd.x86_64 0:1.5.5-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================
 Package            Arch              Version                   Repository                              Size
============================================================================================================
Installing:
 libzstd            x86_64            1.5.5-1.el7               /libzstd-1.5.5-1.el7.x86_64            775 k

Transaction Summary
============================================================================================================
Install  1 Package

Total size: 775 k
Installed size: 775 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libzstd-1.5.5-1.el7.x86_64                                                                1/1
  Verifying  : libzstd-1.5.5-1.el7.x86_64                                                                1/1

Installed:
  libzstd.x86_64 0:1.5.5-1.el7

Complete!

 

2. cent os 키 파일 내려받기

[root@localhost tmp]# sudo curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 \
>   http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1690  100  1690    0     0    870      0  0:00:01  0:00:01 --:--:--   870
[root@localhost tmp]#
[root@localhost tmp]# sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 

3. postgresql 설치

sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql15-server
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
sudo systemctl enable postgresql-15
sudo systemctl start postgresql-15

 

3-1. 혹시나 키 파일 관련 오류나면 아래꺼 진행 (대신 보안은 약함) GPG 끄기

sudo sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/*.repo

 

4. 설치확인

[root@localhost tmp]# sudo 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 Thu 2025-09-11 15:27:39 KST; 1min 48s ago
     Docs: https://www.postgresql.org/docs/15/static/
  Process: 483 ExecStartPre=/usr/pgsql-15/bin/postgresql-15-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 489 (postmaster)
   CGroup: /system.slice/postgresql-15.service
           ├─489 /usr/pgsql-15/bin/postmaster -D /var/lib/pgsql/15/data/
           ├─491 postgres: logger
           ├─492 postgres: checkpointer
           ├─493 postgres: background writer
           ├─495 postgres: walwriter
           ├─496 postgres: autovacuum launcher
           └─497 postgres: logical replication launcher

Sep 11 15:27:39 localhost.localdomain systemd[1]: Starting PostgreSQL 15 database server...
Sep 11 15:27:39 localhost.localdomain postmaster[489]: 2025-09-11 15:27:39.155 KST [489] LOG:  redirec...ess
Sep 11 15:27:39 localhost.localdomain postmaster[489]: 2025-09-11 15:27:39.155 KST [489] HINT:  Future...g".
Sep 11 15:27:39 localhost.localdomain systemd[1]: Started PostgreSQL 15 database server.
Hint: Some lines were ellipsized, use -l to show in full.
728x90