用yum在CentOS7上安装PostgreSQL9.6
在命令行中,安装PostgreSQL9.6。
1. 使用wget命令下载https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm。
2. 使用rpm命令进行安装pgdg-centos96-9.6-3.noarch.rpm。
3. 使用yum命令安装postgresql96-server、postgresql96-devel、postgresql96-contrib。
4. 执行initdb命令。
/usr/pgsql-9.6/bin/postgresql96-setup initdb –no-locale
/usr/pgsql-9.6/bin/postgresql96-setup initdb –locale=C
/usr/pgsql-9.6/bin/postgresql96-setup initdb –encoding=UTF8 –no-locale
/usr/pgsql-9.6/bin/postgresql96-setup initdb –encoding=UTF-8 –locale=ja_JP.UTF-8
添加了选项会导致错误。(描述可能有误?)
使用 /usr/pgsql-9.6/bin/postgresql96-setup initdb 进行初始化是可行的。
5. 设置密码
passwd postgres
6. 启动 PostgreSQL
systemctl start postgresql-9.6
systemctl enable postgresql-9.6
重启PostgreSQL-9.6操作系统服务。
7. 修改 conf 文件,并允许连接
vi /var/lib/pgsql/9.6/data/pg_hba.conf
通过编辑 pg_hba.conf 文件,尝试了以下选项,但除了 trust 以外,无法从 pgadmin Ⅲ 进行连接。
以下为错误选项:
host all all 192.168.24.0/24 md5
host all all 192.168.24.0/24 password
host all all 192.168.24.0/24 krb5
host all all 192.168.24.0/24 ident
host all all 192.168.24.0/24 cert
请点击以下链接,查看详细步骤和屏幕截图:http://a23.sblo.jp/article/177152049.html。