【ローカル開発】ローカル開発環境構築③postgresqlのインストール~初期設定

目的

↓の続き。teratermにてlinuxにアクセスして、postgresqlをインストール~初期設定までを実施できるようにする。

 

kumecchi.hateblo.jp

 

実施方法

以下の手順は、TeratermからVM上のlinuxに接続して行っている。

 

postgresqlのパッケージをインストール

以下のコマンドを実行してpostgresqlのパッケージをインストールする。

f:id:kumecchi:20190101220946p:plain

postgresqlのパッケージをインストール

 ②postgreのサービスを起動

以下のコマンドを実行してpostgresqlのサービスを起動する。

f:id:kumecchi:20190101221328p:plain

postgresのサービスを起動

psqlにてロールとユーザを作成

f:id:kumecchi:20190101221851p:plain

postgresユーザのパスワードを設定してpsqlを実行

psqlを実行後、以下のコマンドを実行する。

roleとdatabaseを作成する。

 

f:id:kumecchi:20190101222353p:plain

create role

f:id:kumecchi:20190101222355p:plain

create database

pg_hba.confの設定を変更する。

f:id:kumecchi:20190101222730p:plain

postgreユーザとlinuxユーザの対応付けをせずに済むよう設定変更

f:id:kumecchi:20190101223115p:plain

confの設定

conf設定がおわったら、postgresqlを再起動する。

f:id:kumecchi:20190101223602p:plain

postgresqlの再起動

 

以上で設定は完了。