大网数据广告活动
服务器运维问答

how to set postgresql 9.6.2 to autostart when built from source on CentOS 7

· 52CE 我爱测

I've installed postgresql 9.6.2 from running from source. I performed the .configure , make and make install commands, which installed the database perfectly. I then installed the user, created the db using createdb command, and …

问题原文

原帖链接 · arcee123 · CC BY-SA 3.0

I've installed postgresql 9.6.2 from running from source. I performed the .configure, make and make install commands, which installed the database perfectly. I then installed the user, created the db using createdb command, and am able to log in locally to postgresql user to perform local sql queries.

My question is autostart. How do I set it up so autostart is working? the command service postgresql restart errors saying no unit. I also tried postgresql-9.6, postgresql-9.6.2, postgresql-962, and several others to no avail.

how to I configure this? Thanks.

已采纳解答

原帖链接 · user653399 · CC BY-SA 4.0

When using systemd, you can use the following service unit file (e.g., at /etc/systemd/system/postgresql.service):

[Unit]
Description=PostgreSQL database server
Documentation=man:postgres(1)

[Service]
Type=notify
User=postgres
ExecStart=/usr/pgsql-9.5/bin/pg_ctl -D /bd-01/pgsql/9.5/data -l logfile start
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0

[Install]
WantedBy=multi-user.target

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-02-27)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。