1 | $ sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' > /etc/apt/sources.list.d/pgdg.list" |
2. 公開鍵を信頼キーリストに追加
1 | $ wget --quiet -O - http: //apt .postgresql.org /pub/repos/apt/ACCC4CF8 .asc | sudo apt-key add - |
1 | $ apt-key list |
3. パッケージを更新
1 | $ sudo apt -y update |
4. インストール実行
1 | $ sudo apt install -y postgresql-9.6 |
5.設定ファイルの変更
1 | $ sudo vim /etc/postgresql/9 .6 /main/postgresql .conf |
1 2 3 | #listen_addresses = 'localhost' ↓ listen_addresses = '*' |
1 | $ sudo vim /etc/postgresql/9 .6 /main/pg_hba .conf |
1 2 | host all all 127.0.0.1/32 trust host all all localhost trust |
6.「postgres」ユーザーへのパスワード設定
1 | $ sudo passwd postgres |
7.サービスコマンド
1 | $ sudo service postgresql start |
1 | $ sudo service postgresql stop |
1 | $ sudo service postgresql restart |