无法为PostgreSQL-9.6初始化数据库

无法为PostgreSQL-9.6初始化数据库,postgresql,initialization,centos7,postgresql-9.6,Postgresql,Initialization,Centos7,Postgresql 9.6,我正在设置一个新的虚拟服务器来运行Netbox,一个IP地址管理服务器。我正在安装所有依赖项,并且在PostgreSQL server数据库初始化方面遇到问题 我在CentOS 7上安装了PostgreSQL 9.6(也在CentOS 7上尝试了PostgreSQL 9.5,但遇到了相同的问题) 我无法初始化数据库 我在网上找到的安装指南都说了同样的话: 按如下方式初始化数据库: # /usr/pgsql-9.6/bin/postgresql96-setup initdb find / -na

我正在设置一个新的虚拟服务器来运行Netbox,一个IP地址管理服务器。我正在安装所有依赖项,并且在PostgreSQL server数据库初始化方面遇到问题

我在CentOS 7上安装了PostgreSQL 9.6(也在CentOS 7上尝试了PostgreSQL 9.5,但遇到了相同的问题)

我无法初始化数据库

我在网上找到的安装指南都说了同样的话:

按如下方式初始化数据库:

# /usr/pgsql-9.6/bin/postgresql96-setup initdb
find / -name "postgresql96-setup"
这将产生以下输出:

-bash: /usr/pgsql-9.6/bin/postgresql96-setup: No such file or directory
因此,文件系统中似乎不存在文件“postgresql96安装程序”

我已使用find命令尝试定位文件,如下所示:

# /usr/pgsql-9.6/bin/postgresql96-setup initdb
find / -name "postgresql96-setup"
find命令什么也找不到

下面是文件夹/usr/pgsql-9.6/bin的内容/

[root@prdsw1mgtapp39 bin]# ls -lh
total 9.6M
-rwxr-xr-x 1 root root  52K May  8 10:08 clusterdb
-rwxr-xr-x 1 root root  52K May  8 10:08 createdb
-rwxr-xr-x 1 root root  85K May  8 10:08 createlang
-rwxr-xr-x 1 root root  57K May  8 10:08 createuser
-rwxr-xr-x 1 root root  48K May  8 10:08 dropdb
-rwxr-xr-x 1 root root  85K May  8 10:08 droplang
-rwxr-xr-x 1 root root  48K May  8 10:08 dropuser
-rwxr-xr-x 1 root root 844K May  8 10:08 ecpg
-rwxr-xr-x 1 root root  98K May  8 10:08 initdb
-rwxr-xr-x 1 root root  24K May  8 10:08 oid2name
-rwxr-xr-x 1 root root  15K May  8 10:08 pg_archivecleanup
-rwxr-xr-x 1 root root  72K May  8 10:08 pg_basebackup
-rwxr-xr-x 1 root root 121K May  8 10:08 pgbench
-rwxr-xr-x 1 root root  26K May  8 10:08 pg_config
-rwxr-xr-x 1 root root  36K May  8 10:08 pg_controldata
-rwxr-xr-x 1 root root  41K May  8 10:08 pg_ctl
-rwxr-xr-x 1 root root 379K May  8 10:08 pg_dump
-rwxr-xr-x 1 root root  85K May  8 10:08 pg_dumpall
-rwxr-xr-x 1 root root  48K May  8 10:08 pg_isready
-rwxr-xr-x 1 root root  50K May  8 10:08 pg_receivexlog
-rwxr-xr-x 1 root root  54K May  8 10:08 pg_recvlogical
-rwxr-xr-x 1 root root  44K May  8 10:08 pg_resetxlog
-rwxr-xr-x 1 root root 148K May  8 10:08 pg_restore
-rwxr-xr-x 1 root root  76K May  8 10:08 pg_rewind
-rwxr-xr-x 1 root root  20K May  8 10:08 pg_standby
-rwxr-xr-x 1 root root  18K May  8 10:08 pg_test_fsync
-rwxr-xr-x 1 root root  13K May  8 10:08 pg_test_timing
-rwxr-xr-x 1 root root 112K May  8 10:08 pg_upgrade
-rwxr-xr-x 1 root root  66K May  8 10:08 pg_xlogdump
-rwxr-xr-x 1 root root 6.2M May  8 10:08 postgres
lrwxrwxrwx 1 root root    8 Jun  7 20:23 postmaster -> postgres
-rwxr-xr-x 1 root root 526K May  8 10:08 psql
-rwxr-xr-x 1 root root  56K May  8 10:08 reindexdb
-rwxr-xr-x 1 root root  60K May  8 10:08 vacuumdb
-rwxr-xr-x 1 root root  21K May  8 10:08 vacuumlo
我是不是遗漏了什么? 如果安装程序二进制文件(/usr/pgsql-9.6/bin/postgresql96 setup)丢失,我应该如何运行initialize database命令

安装二进制文件是否已被弃用,或者是否需要创建链接或其他脚本? 我甚至安装了PostgreSQL 9.5,以查看该文件是否存在于该版本中,但事实并非如此

备用数据库初始化方法 我运行了一个“可选”命令,该命令在CentOS 7上安装PostgreSQL 9.3的指南中给出:

初始化数据库: 如果上一个命令失败,请直接调用安装二进制文件:

sudo /usr/pgsql-9.3/bin/postgresql93-setup initdb
使用PostgreSQL 9.6的备用数据库初始化 我运行命令:

service postgresql-9.6 initdb
这是可行的,我可以设置数据库、创建用户、创建表等,但重新启动后,PostgrSQL-9.6服务无法启动

以下是postgresql 9.6的systemctl输出

[root@prdsw1mgtapp39 bin]# systemctl | grep postgres*

UNIT                        LOAD   ACTIVE SUB       DESCRIPTION
● postgresql-9.6.service    loaded failed failed    SYSV: PostgreSQL database server.
以下是postgresql-9.6服务的systemctl状态

[root@prdsw1mgtapp39 bin]# systemctl status postgresql-9.6.service
● postgresql-9.6.service - SYSV: PostgreSQL database server.
Loaded: loaded (/etc/rc.d/init.d/postgresql-9.6; bad; vendor preset: 
disabled)
Active: failed (Result: exit-code) since Sun 2019-06-09 10:50:27 BST; 
2h 40min ago
Docs: man:systemd-sysv-generator(8)
Process: 26266 ExecStart=/etc/rc.d/init.d/postgresql-9.6 start 
(code=exited, status=1/FAILURE)

Jun 09 10:50:24 prdsw1mgtapp39 systemd[1]: Starting 
SYSV: PostgreSQL database server....
Jun 09 10:50:27 prdsw1mgtapp39 postgresql-9.6[26266]:                 
Starting postgresql-9.6 service: [FAILED]
Jun 09 10:50:27 prdsw1mgtapp39 systemd[1]: 
postgresql-9.6.service: control process exited, code=exited status=1
Jun 09 10:50:27 prdsw1mgtapp39 systemd[1]: Failed to 
start SYSV: PostgreSQL database server..
Jun 09 10:50:27 prdsw1mgtapp39 systemd[1]: Unit 
postgresql-9.6.service entered failed state.
Jun 09 10:50:27 prdsw1mgtapp39 systemd[1]: 
postgresql-9.6.service failed.
我以root用户身份进行操作,遇到一些情况,它会抱怨并告诉我以低权限用户身份运行,在这种情况下,我打开另一个终端,以用户身份登录,并在必要时使用sudo选项

非常感谢您的建议