환경
- Linux, Centos7
- PostgreSQL v.13
1. PostgreSQL 설치
DB 설치
$ 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 postgresql13-server
DB 초기화 (기본 DB 생성)
$ sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
서비스 등록 및 실행
$ sudo systemctl enable postgresql-13
$ sudo systemctl start postgresql-13
DB user 및 schema 생성
$ sudo -u postgres psql
alter user postgres password {password};
create user root with superuser createdb password {password};
create database cai with owner postgres encoding 'UTF8';
2. 외부 접속 설정
$ vi /var/lib/pgsql/13/data/postgresql.conf
--> listen_addresses = '*'
--> post = 5432
$ echo "host all all 0.0.0.0/0 md5" >> /var/lib/pgsql/13/data/pg_hba.conf
DB stop
$ systemctl stop postgresql-13
방화벽 설정 및 DB restart
$ firewall-cmd --permanent --add-port=5432/tcp
$ firewall-cmd --reload
$ systemctl start postgresql-13
2021.10.31 - [IT story/DB] - [PostgreSQL] PostgreSQL docker 설치 및 외부접속
2021.10.29 - [IT story/DB] - [PotgreSQL] PostgreSQL 이중화 (HA)
https://www.postgresql.org/download/linux/redhat/
https://copycoding.tistory.com/312)
'DataBase > PostgreSQL' 카테고리의 다른 글
[PostgresSQL] 외부접속 허용 (Linux CentOS7) (0) | 2023.09.27 |
---|---|
[PostgreSQL] pg_basebackup vs pg_rewind (0) | 2021.11.22 |
[PostgreSQL] PGDATA 경로 변경 (0) | 2021.11.21 |
[PostgreSQL] PostgreSQL docker 설치 및 외부접속 (2) | 2021.10.31 |