Recent Posts
Recent Comments
Link
06-30 12:53
Today
Total
관리 메뉴

삶 가운데 남긴 기록 AACII.TISTORY.COM

Postgresql 14 CentOS 7 설치 본문

DEV&OPS/Database

Postgresql 14 CentOS 7 설치

ALEPH.GEM 2023. 12. 21. 08:29

https://www.postgresql.org/download/linux/redhat/

 

 

PostgreSQL: Linux downloads (Red Hat family)

Linux downloads (Red Hat family) The Red Hat family of distributions includes: Red Hat Enterprise Linux Rocky Linux AlmaLinux CentOS (7 and 6 only) Fedora Oracle Linux and others. PostgreSQL is available on these platforms by default. However, each version

www.postgresql.org

에 방문하면 자신의 환경에 맞는 설치 스크립트를 copy할 수 있습니다.

여기에서는 Centos7, postgresql-14를 기준으로 작성되었습니다.

 

아래는 설치 스크립트입니다. 

리눅스 쉘에서 하나씩 따라서 설치 하시면 됩니다.

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 postgresql14-server

sudo /usr/pgsql-14/bin/postgresql-14-setup initdb

sudo systemctl enable postgresql-14

sudo systemctl start postgresql-14

 

 

 

postgresql 서버 포트 확인

netstat -nltp

 

 

접속 포트 열기

우선 postgresql.conf파일을 찾습니다..

find / -name postgresql.conf

그런다음에 찾은 경로로 이동한 뒤

cd /var/lib/pgsql/14/data/

vim으로 설정을 편집합니다.

vi postgresql.conf


에서 Listen address = 'localhost'를 Listen address = '*' 로 수정합니다.
그리고 port = 5432 주석을 해제합니다.

 

 

접속 설정

우선 위와 같은 경로에서 

cd /var/lib/pgsql/14/data/

pg_hba.conf 파일을 편집합니다..

vi pg_hba.conf

의 마지막에 아래 내용을 추가합니다.

host    all             all             0.0.0.0/0               md5

 

 

 

서비스 재시작

sudo systemctl restart postgresql-14

 

 

비밀번호 초기화

postgres 계정 전환

su - postgres

postgresql 접속

psql

 

패스워드 변경 쿼리 실행

alter user postgres with password '바꿀비밀번호';

 

 

 

방화벽 열기

postgresql의 기본 포트는 5432입니다.

sudo firewall-cmd --permanent --add-port=5432/tcp
sudo firewall-cmd --reload

 

 

 

 

 

 

 

 

 

 

 

 

728x90

'DEV&OPS > Database' 카테고리의 다른 글

오라클 데이터베이스 19c 리눅스 백업 dump 및 복원  (2) 2024.01.12
postgresql 14 스키마 생성  (3) 2024.01.09
MySQL utf8 설정  (0) 2022.12.29
MYSQL 최적화  (0) 2022.08.02
ORA-28001 오라클 비밀번호 만료  (0) 2022.07.15