You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在CentOS 7.4上将PostgreSQL从9.6.5升级到9.6.14以解决pg_restore报错

CentOS 7 安装PostgreSQL 9.6.14版本RPM包操作指南

操作前需提前备份现有PostgreSQL的所有数据、配置文件,避免操作失误导致数据丢失。

操作步骤

  • 停止现有PostgreSQL服务
    执行命令:systemctl stop postgresql-9.6
  • 卸载旧版本9.6.5的相关组件
    执行命令:yum remove postgresql96*
    若有其他业务依赖该系列的lib包不想被卸载,可单独指定卸载核心组件:yum remove postgresql96-server postgresql96 postgresql96-contrib
  • 安装9.6.14版本对应RPM包
    若使用yum在线安装,先确认已经配置PostgreSQL 9.6系列的yum源,直接执行命令指定版本安装即可:
    yum install -y postgresql96-server-9.6.14-1PGDG.rhel7 postgresql96-9.6.14-1PGDG.rhel7 postgresql96-contrib-9.6.14-1PGDG.rhel7 postgresql96-libs-9.6.14-1PGDG.rhel7
    若为离线安装场景,可提前下载上述四个对应版本的RPM包到本地目录,执行本地安装命令:
    yum localinstall -y ./postgresql96-*.rpm
  • 验证安装结果
    执行命令查看pg_restore版本:pg_restore --version
    输出pg_restore (PostgreSQL) 9.6.14即代表安装成功。
  • 恢复业务
    PostgreSQL同大版本内的小版本升级不需要做数据迁移,将之前备份的配置文件(postgresql.conf、pg_hba.conf等)放回对应数据目录,直接启动服务即可:
    systemctl start postgresql-9.6
    之后即可正常使用pg_restore恢复之前的自定义格式备份文件。

内容的提问来源于stack exchange,提问作者ReemICS

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.17 23:36:03