在 Centos 7 上设置 Postgresql-93
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25142442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Set up Postgresql-93 on Centos 7
提问by Gatuno
I followed this Almost idiot's guideto install postgresql and postgis on Centos 7and got stuck starting the database itself with the following command:
我按照这个几乎白痴的指南在Centos 7上安装 postgresql 和 postgis并使用以下命令启动数据库本身:
[root@localhost cmaps]# service postgresql-9.3 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.
If I install the postgresql package from Centos repository (version 9.2) the command works, but then I they don't have postgis, and there is no official posgresql-92 repository for Centos 7.
如果我从 Centos 存储库(版本 9.2)安装 postgresql 包,该命令可以工作,但是我没有 postgis,并且没有用于 Centos 7 的官方 posgresql-92 存储库。
Any idea on what's happening?
知道发生了什么吗?
Thank you!
谢谢!
回答by veradiego31
I had the same problem and solve it by changing the path
我遇到了同样的问题并通过更改路径来解决它
/usr/pgsql-9.3/bin/postgresql93-setup initdb
Note that the path is different
注意路径不同
回答by Craig Ringer
CentOS 7 is based on systemd. PostgreSQL packages use a different command for initdb there:
CentOS 7 基于 systemd。PostgreSQL 包对 initdb 使用不同的命令:
/usr/lib/pgsql-9.3/bin/postgresql93-setup initdb
On older versions, call the initscript directly.
在旧版本上,直接调用 initscript。
/etc/init.d/postgresql-9.3 initdb
回答by helvete
For Centos 7.3 installed on MS Azure platformthe script is located at
对于安装在MS Azure 平台上的 Centos 7.3 ,脚本位于
/usr/bin/postgresql-setup initdb
the version number is absent from the name of these as well:
这些名称中也没有版本号:
- db data & config location:
/var/lib/pgsql/data/
- service name
/sbin/service postgresql status
orsystemctl status postgresql.service
- 数据库数据和配置位置:
/var/lib/pgsql/data/
- 服务名称
/sbin/service postgresql status
或systemctl status postgresql.service