DataBase/PostgreSql

[PostgreSQL] Ubuntu에서 PostgreSQL 설치

써니의 연습장 2023. 1. 23. 12:44

[PostgreSQL] Ubuntu에서 PostgreSQL 설치

0. 개발환경

- Ubuntu 버전: 18.04

- PostgreSQL 버전: 15

 

1. postgresql debian packages key  및 repository 추가

 

sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

 

 

 

2. apt-get 업데이트 및 postgresql 특정 버전 설치

 

sudo apt-get update

sudo apt-get install postgresql postgresql-15

 

 

 

3. Postgresql 서비스 등록 및 활성화 확인

 

systemctl status postgresql

 

결과예시:

-> Ubuntu에 postgresql.service로 등록되며, 설치 완료 후 자동으로  Active 상태가 활성화된 것을 확인 할 수 있다.