postgresをインストールする

sudo yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm
sudo yum update
sudo yum install postgresql96 postgresql96-server postgresql96-libs
[vagrant@localhost ~]$ rpm -qa | grep postgres
postgresql96-server-9.6.15-1PGDG.rhel6.x86_64
postgresql96-9.6.15-1PGDG.rhel6.x86_64
postgresql96-libs-9.6.15-1PGDG.rhel6.x86_64

[vagrant@localhost ~]$ service postgresql-9.6 initdb
データベースを初期化中: mkdir: ディレクトリ `/var/lib/pgsql’ を作成できません: 許可がありません
[vagrant@localhost ~]$ sudo service postgresql-9.6 initdb
データベースを初期化中: [ OK ]

[vagrant@localhost ~]$ sudo service postgresql-9.6 start
postgresql-9.6 サービスを開始中: [ OK ]
[vagrant@localhost ~]$ service postgresql-9.6 status
postgresql-9.6 (pid 20665) を実行中…
[vagrant@localhost ~]$ chkconfig postgresql-9.6 –list
postgresql-9.6 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[vagrant@localhost ~]$ chkconfig postgresql-9.6 on
この操作を実行するためには権限が十分ではありません。
[vagrant@localhost ~]$ sudo chkconfig postgresql-9.6 on
[vagrant@localhost ~]$ chkconfig postgresql-9.6 –list
postgresql-9.6 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[vagrant@localhost ~]$ su – postgres
パスワード:
su: パスワードが違います
なにいいいいいいいいいいいい