2014-09-03 63 views
0

所以,如何在centos7上運行initdb for postgresql 9.2?

我的管理員安裝(不知道如何)在centos7機器上的postgresql 9.2(64位版本)。事情是我需要initalize數據庫,所以我應該運行是這樣的:

service postgresql-9.2 initdb 

,但我得到的錯誤:

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. 

做了一些搜索和人說你應該通過直接調用一些初始化腳本,但每個給定的位置都不存在於此CentOS 7機器中。

例如像這個位置(是的,它是9.3,我用9.2,但類似的位置不反正存在):

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

或本

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

我發現

/usr/lib64/pgsql 

但這個目錄只有一堆'* .so'文件。

我該如何在centos7上運行initdb for postgresql 9.2?

+2

您是否嘗試過'which initdb','locate initdb'或'find/usr -name initdb'?在Ubuntu上它位於'/ usr/lib/postgresql/9.2/bin/initdb'中;我不知道你可能會在Centos上找到它。 – 2014-09-03 15:51:43

+0

@ MikeSherrill'CatRecall','initdb'找到'/ usr/bin/initdb'。但是,我無法在Internet上找到initdb可能位於此目錄中的任何信息。也許管理員以一種奇怪的方式安裝它。將嘗試重新安裝只是爲了確保。 – user1463822 2014-09-04 06:52:00

回答

0

剛剛在Centos上安裝了Postgresql 9.3。

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

並有posgresql-9.3腳本

#./postgresql-9.3 

給你的選項與運行,其中之一是在initdb

+0

在這個安裝中,initdb是一個獨立的編譯可執行文件嗎? – 2014-09-03 19:51:39

+0

是否有編譯它的具體原因?應該有編譯它的安裝說明。查看源代碼樹中的INSTALL或README。 – Aret 2014-09-03 19:55:00

+0

我很好奇差異。在我的Ubuntu盒子裏,initdb是一個編譯好的可執行文件,這意味着「which」,「locate」或者「find」應該能夠找到它。在你的Centos安裝中,postgresql-9.3腳本的「initdb」選項可以想象爲一個可執行文件,就像我的盒子,另一個腳本或不同的編譯程序的一部分。 – 2014-09-03 20:32:01

-1

你可以運行它直接從Postgres的帳號

#su - postgres -c pg_ctl initdb 
相關問題