尧图网络科技YAOTU DIGITAL 获取报价
获取报价
首页 / 资讯中心 / 文章详情

将postgresql配置为Linux服务管理 systemctl service

发布时间:2026/11/17 8:29:22

资讯中心
01
ARTICLE

将postgresql配置为Linux服务管理 systemctl service

将postgresql配置为Linux服务管理 systemctl service
发行版安装的数据库在装完后会自动添加数据库服务但编译安装的不会需要手动添加。cd postgresql-14.0/contrib/start-scripts/cp linux /etc/init.d/postgresqlcd /etc/init.d/vipostgresql修改以下部分## EDIT FROM HERE# Installation prefixprefix/data/postgres/base/14.0# Data directoryPGDATA/data/postgres/pg5432/data# Who to run the postmaster as, usually postgres. (NOT root)PGUSERpostgres# Where to keep a log filePGLOG$PGDATA/log再改下启动命令case $1 instart)echo -n Starting PostgreSQL: test -e $PG_OOM_ADJUST_FILE echo $PG_MASTER_OOM_SCORE_ADJ $PG_OOM_ADJUST_FILEsu - $PGUSER -c $PGCTL start -D $PGDATA -secho ok;;加执行权限chmod x postgresql通过下面的命令添加到服务中chkconfig --add postgresql否则会报错[rootlocalhost init.d]# systemctl stop postgresqlFailed to stop postgresql.service: Unit postgresql.service not loaded.相应的可通过下述命令删除chkconfig --del postgresql如果后面修改了postgresql文件需要reloadsystemctl daemon-reload启动测试systemctl start postgresqlsystemctl status postgresqlps -ef|grep postgres关闭测试systemctl stop postgresqlps -ef|grep postgres参考PGCE课程《服务管理》
02
RELATED NEWS

相关资讯

更多网站建设与数字化升级内容

03
WHY YAOTU

想打造同款高转化官网?

懂行业、懂生意,从建站到增长一站式陪跑

◈

场景化定制

不做模板站,围绕你的业务场景量身设计,小众不撞款。

◐

营销型架构

以转化目标组织内容与路径,让官网真正带来询盘。

▲

全周期服务

设计、开发、运营、运维一体,上线只是开始。

免费获取你的建站方案

留下需求,专属顾问 24 小时内为你输出方案建议。