기준 Ubuntu20.04, PostgreSQL 15
/etc/postgresql/[버전]/main로 이동listen_port="localhost"의 주석을 해제하여 listen_port="*"로 바꾼다.pg_hba.conf도 마찬가지로 root 권한으로 편집하여 # IPv4 local connections:
host    all             all             127.0.0.1/32            
를
# IPv4 local connections:
host    all             all             0.0.0.0/0            
로 바꾼다.
4. PostgreSQL서비스 재시작
5. 알맞게 방화벽 설정이나 포트포워딩을 진행
6. 원격 접속 테스트