セキュリティ等考慮されていないので注意
参考: CentOS 7 : PostgreSQL : インストール : Server World
インストール&セットアップ
$ sudo yum install postgresql-server
$ sudo postgresql-setup initdb
起動
$ sudo systemctl start postgresql
状態確認
$ sudo systemctl status postgresql
設定ファイル
/var/lib/pgsql/data/pg_hba.conf を開き 以下のように trust を設定(ローカル開発用のためtrust 公開されているサーバでこれやっちゃダメ)
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
参考 http://www.dbonline.jp/postgresql/ini/index2.html
変更したら再起動
$ sudo systemctl restart postgresql
接続
$ psql -h localhost -p 5432 -U postgres
で接続できたらOK
停止
$ sudo systemctl stop postgresql