kenu
45k
2019-09-20 16:50:38 작성 2019-09-20 16:52:19 수정됨
0
377

Postgresql DB를 EC2에 설치하기


PostgreSQL

Install on EC2

sudo yum install -y postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
sudo postgresql-setup initdb
  • configure access permission from outside
  • need to open AWS Security Group port 5432
[root@ip-172-31-23-71 data]# sudo su
cd /var/lib/pgsql/data

vim postgresql.conf
#listen_addresses = 'localhost'          # what IP address(es) to listen on;
listen_addresses='*'

#port = 5432
port = 5432
  • register account for development
sudo service postgresql restart

vim /var/lib/pgsql/data/pg_hba.conf
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             okuser          0.0.0.0/0               md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
  • create develop db user
sudo service postgresql restart

sudo su - postgres
CREATE USER okuser NOSUPERUSER;
ALTER USER okuser WITH PASSWORD '$okuserPasswd';
CREATE DATABASE okdevdb WITH OWNER okuser;

\q
  • Connection Info
Host : xxx.209.xxx.248
DB name : okdevdb
username : okuser
password : $okuserPasswd

ref

1
0
  • 댓글 0

  • 로그인을 하시면 댓글을 등록할 수 있습니다.