본문 바로가기
Backup Solution & IT Study/Data Base

[PostgreSQL]Cent OS 7 PostgreSQL 설치부터 Windows pgAdmin 설치 및 연동까지 (1/2)

by DellEMC Backup Engineer 2021. 3. 11.

[PostgreSQL]Cent OS 7 PostgreSQL 설치부터 Windows pgAdmin 설치 및 연동까지 (1/2)

개요

- DellEMC Avamar 에서 postgreSQL 사용하여 백업 관련 DB 데이터를 저장 하고 있어 운영중인 mcdb를 다른 서버에 import 하여 데이터를 확인하기 위함

 

테스트 환경

- Cent OS 7.9 ( Cent OS 2009 )

- PostgreSQL 11.11

- Windows 2019 Std

- pgAdmin 4 v5.0

 

1. yum repolist 확인

**yum kakao 설정 필요 시 bluelicht.tistory.com/50?category=1188753 참조

 

2. PostgreSQL 설치

  A. yum 을 통한 PostgreSQl repo 설치

# 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

 

# Install PostgreSQL:

sudo yum install -y postgresql11-server postgresql-contrib postgresql-devel

 

 

  B. 직접 다운로드

download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/

 

3. systemctl 시작 및 등록

# Optionally initialize the database and enable automatic start:

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

sudo systemctl enable postgresql-11

sudo systemctl start postgresql-11

 

4. Linux 방화벽 추가 firewalld

#방화벽 상태 확인

systemctl status firewalld

#방화벽 등록 포트 확인

firewall-cmd --permanent --zone=public --list-ports

#방화벽 포트 등록

firewall-cmd --permanent --zone=public --add-port=5432/tcp

5. PostgreSQL 설치 확인 및 실행 확인

6. PostgreSQL 기본 셋팅 ( 비밀번호 설정 ) ( 해당 부분 비밀번호 설정 안할경우 pgAdmin 접속 불가 )

# psql 접속

sudo -u postgres psql

# 비밀번호 설정

ALTER USER postgres WITH PASSWORD '1q2w3e4r';

7. PostgreSQL 외부 접속 허용 (1/2)

#listen 접속 허용

vi /var/lib/pgsql/11/data/postgresql.conf

8. PostgreSQL 외부 접속 허용 (2/2)

# 외부 접근 허용

vi /var/lib/pgsql/11/data/pg_hba.conf

아래와 같이 추가

host    all             all             0.0.0.0/0               md5

 

9. PostgreSQL Restart

#Restart Postgresql

sudo systemctl restart postgresql-11

 

 

댓글