2017/03/10
yum install postgresql postgresql-contrib postgresql-devel postgresql-docs postgresql-jdbc postgresql-libs postgresql-server postgresql-test
su - postgres initdb pg_ctl -D /var/lib/pgsql/data start createuser -d webmaster # -d webmasterは新しいデータベースを作ることができる # -R webmasterは別のロールを作成できない(デフォルト) # -S webmasterはスーパーユーザになれない(デフォルト) pg_ctl -w stop wget -O /var/lib/pgsql/data/pg_hba.conf http://www.takahashi.lab/~nt/technicalnote/centos7/pg_hba.conf wget -O /var/lib/pgsql/data/postgresql.conf http://www.takahashi.lab/~nt/technicalnote/centos7/postgresql.conf
systemctl start postgresql systemctl enable postgresql #firewalldにpostgresqlの使用許可(永続的)を通知する firewall-cmd --list-service firewall-cmd --add-service=postgresql --permanent firewall-cmd --reload firewall-cmd --list-service
su - webmaster createdb psql create table sample(tel int,name varchar(50)); insert into sample values(6547,'情報通信実験室'); insert into sample values(6447,'高橋研究室'); SELECT * FROM sample; \qリモートによる接続を確認する。
psql -h 192.168.70.xxx -U webmaster -c 'SELECT * FROM sample'