背景
生产环境安扫,PostgreSQL数据库扫出来一堆漏洞。目前我们线上PostgreSQL数据库版本大部分是9.6.0,PostgreSQL官方9.6最新补丁是9.6.24。
升级步骤
下载PostgreSQL 9.6.24
[root]# wget --no-check-certificate https://ftp.postgresql.org/pub/source/v9.6.24/postgresql-9.6.24.tar.gz
1. 升级前版本查看
postgres=# select version();
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 9.6.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
2. 源码安装PostgreSQL 9.6.24
[root]# tar -zxf postgresql-9.6.24.tar.gz
[root]# cd /root/postgresql-9.6.24
[root]# ./configure --prefix=/usr/local/postgresql-9.6.24 --with-perl --with-python --enable-thread-safety --with-uuid=ossp --with-wal-segsize=64
[root]# make && make install
3. 安装contrib工具
[root]# cd /root/postgresql-9.6.24/contrib
[root]# make && make install
4. 关闭postgres
[postgres]# pg_ctl stop
5. 替换补丁包
[root]# rm -fr /usr/local/postgresql
[root]# ln -s /usr/local/postgresql-9.6.24 /usr/local/postgresql
[root]# chown -R postgres:postgres /usr/local/postgresql-9.6.24
[root]# chown -R postgres:postgres /usr/local/postgresql
6. 启动postgres
[postgres]# pg_ctl start
7. 升级后查看数据库版本
postgres=# select version();
version
-----------------------------------------------------------------------------------------------------------
PostgreSQL 9.6.24 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
至此补丁更新完毕。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示