Install Postgresql 9.6 on CentOS 7 - goddes4/python-study-wiki GitHub Wiki

Install Postgresql 9.6 on CentOS 7

버전에 λ§žλŠ” μ €μž₯μ†Œ μ„€μΉ˜

# wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
# yum install pgdg-centos96-9.6-3.noarch.rpm

μ„€μΉ˜ κ°€λŠ₯ν•œ νŒ¨ν‚€μ§€ 검색

# yum list postgres*

νŒ¨ν‚€μ§€ μ„€μΉ˜

# yum install postgresql96-server

# vi /var/lib/pgsql/9.6/data/postgresql.conf

λ°©ν™”λ²½ μ„€μ •

# firewall-cmd --permanent --zone=public --add-port=5432/tcp
# firewall-cmd --reload

DB 생성

# /usr/pgsql-9.6/bin/postgresql96-setup initdb

μ„œλΉ„μŠ€ 등둝 및 μ‹œμž‘

# systemctl enable postgresql-9.6.service
# systemctl start postgresql-9.6.service

db 계정 μΆ”κ°€

μ‚¬μš©μž 등둝

# adduser sentry

sentry 용 계정과 DB λ₯Ό μƒμ„±ν•˜κΈ° μœ„ν•΄ pgsql ν”„λ‘¬ν”„νŠΈλ₯Ό ꡬ동

# su postgres
# psql -U postgres

"postgres=#" ν”„λ‘¬ν”„νŠΈμ—μ„œ μ‚¬μš©μžμ™€ database λ₯Ό μƒμ„±ν•˜κ³  κΆŒν•œμ„ λΆ€μ—¬

# create user sentry;
# create database sentrydb ENCODING 'UTF-8' ;
# GRANT ALL PRIVILEGES ON DATABASE sentrydb TO sentry;

μ‚¬μš©μž DB μ•”ν˜Έ μ„€μ •

# \password sentry