반응형
시스템 패키지 업데이트
sudo apt update && sudo apt upgrade -y
PostgreSQL 설치
sudo apt install -y postgresql postgresql-client
PostgreSQL 서비스 상태 확인
psql --version
sudo systemctl status postgresql
PostgreSQL 서비스 시작 및 활성화
sudo systemctl start postgresql
sudo systemctl enable postgresql
PostgreSQL 기본 설정
# postgres라는 사용자 계정을 생성
sudo -i -u postgres
# 쉘접속
psql
# 종료
\q
새 사용자 및 데이터베이스 생성
# PostgreSQL에서 새로운 사용자와 데이터베이스
CREATE USER kyshop_user WITH PASSWORD '강력한비밀번호';
ALTER USER kyshop_user WITH SUPERUSER;
CREATE DATABASE kyshop_db OWNER kyshop_user ENCODING 'UTF8';
GRANT ALL PRIVILEGES ON DATABASE kyshop_db TO kyshop_user;
# PostgreSQL에 접속하여 확인
psql -h 127.0.0.1 -p 5432 -U username -d dbname
외부 접속 허용 설정
sudo vim /etc/postgresql/16/main/postgresql.conf
# 다음 줄을 찾아 주석을 해제하고 수정
listen_addresses = '*'
sudo vim /etc/postgresql/16/main/pg_hba.conf
# 다음 줄을 추가
host all all 0.0.0.0/0 md5
PostgreSQL 서비스 재시작
sudo systemctl restart postgresql
반응형
'DevOps > 리눅스' 카테고리의 다른 글
| ubuntu 24.04 mysql 설치 (0) | 2025.03.13 |
|---|---|
| ubuntu 24.04 도커 Nginx, Https, Samba 설치 (0) | 2025.03.10 |
| ujubuntu 24.04 원격데스크탑 접속 (0) | 2025.03.08 |
| MobaXTerm 으로 복사 붙여넣기 할때 in '^[[200~required text~' (0) | 2025.03.07 |
| ubuntu 24.04 Samba(SMB) 설치 (0) | 2025.03.07 |
댓글