简体   繁体   English

如何在centos7上为PostgreSQL 9.2运行initdb?

[英]How to run initdb for postgresql 9.2 on centos7?

So, 所以,

My admin installed (don't know how) postgresql 9.2 (64 bit version) on a centos7 machine. 我的管理员在centos7机器上安装(不知道如何)postgresql 9.2(64位版本)。 The thing is I need to initalize the database so I should run something like: 事情是我需要初始化数据库,所以我应该运行类似的东西:

service postgresql-9.2 initdb

but I get error: 但我得到错误:

The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

Did some search and people said that you should initialize via direct call to some script, but every given location does not exists in this CentOS 7 machine. 进行了一些搜索后,人们说您应该通过直接调用某些脚本来初始化,但是此CentOS 7机器中不存在每个给定的位置。

Like for example this location (yeah, it is for 9.3 and I use 9.2, but similar location does not exist anyway): 例如,例如以下位置(是的,它用于9.3,而我使用9.2,但是无论如何都不存在类似的位置):

/usr/lib/pgsql-9.3/bin/postgresql93-setup initdb

or this 或这个

/usr/pgsql-9.3/bin/postgresql93-setup initdb

I found out 我发现

/usr/lib64/pgsql 

but this directory has only a bunch of '*.so' files. 但是该目录只有一堆“ * .so”文件。

How the hell do I run initdb for postgresql 9.2 on centos7? 我该如何在centos7上为PostgreSQL 9.2运行initdb?

Just installed the Postgresql 9.3 on Centos. 刚刚在Centos上安装了Postgresql 9.3。

#cd /etc/init.d
#ls postgres*

and there is a posgresql-9.3 script 并且有一个posgresql-9.3脚本

#./postgresql-9.3 

gives you the options to run with and one of them is initdb 提供给您运行的选项,其中之一是initdb

您可以直接从postgres帐户运行它

#su - postgres -c pg_ctl initdb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM