PostgreSQL-小版本升级

1.版本信息:

升级前升级后
postgre14.6postgre14.11

2.升级步骤

2.1下载升级包

[root@localhost postgresql]# wget https://ftp.postgresql.org/pub/source/v14.11/postgresql-14.11.tar.bz2

2.2安装新版本postgresql

[root@localhost postgresql]# tar -xvf postgresql-14.11.tar.bz2

[root@localhost postgresql]# cd postgresql-14.11

#创建安装目录
[root@localhost postgresql-14.11]# mkdir -p  /usr/local/pgsql14.11

#编译安装
[root@localhost postgresql-14.11]# ./configure --prefix=/usr/local/pgsql14.11 --with-perl --with-python --with-libxml --with-libxslt --with-openssl

[root@localhost postgresql-14.11]# make && make install

#查看是否安装到指定目录:/usr/local/pgsql14.11
[root@localhost pgsql14.11]# pwd
/usr/local/pgsql14.11
[root@localhost pgsql14.11]# ll
total 16
drwxr-xr-x 2 root root 4096 May  2 04:33 bin
drwxr-xr-x 6 root root 4096 May  2 04:33 include
drwxr-xr-x 4 root root 4096 May  2 04:33 lib
drwxr-xr-x 6 root root 4096 May  2 04:33 share
[root@localhost pgsql14.11]#

#编译插件
[root@localhost contrib]# pwd
/soft/postgresql/postgresql-14.11/contrib

[root@localhost contrib]# make && make install

 3.生成软连接/替换旧版本安装目录

[root@localhost local]# cd /usr/local
[root@localhost local]# pwd
/usr/local
[root@localhost local]# ll
total 0
drwxr-xr-x. 2 root root  6 Apr 11  2018 bin
drwxr-xr-x. 2 root root  6 Apr 11  2018 etc
drwxr-xr-x. 2 root root  6 Apr 11  2018 games
drwxr-xr-x. 2 root root  6 Apr 11  2018 include
drwxr-xr-x. 2 root root  6 Apr 11  2018 lib
drwxr-xr-x. 2 root root  6 Apr 11  2018 lib64
drwxr-xr-x. 2 root root  6 Apr 11  2018 libexec
lrwxrwxrwx  1 root root 20 Apr 29 08:10 pgsql -> /usr/local/pgsql14.6
drwxr-xr-x  6 root root 56 May  2 04:33 pgsql14.11
drwxr-xr-x  6 root root 56 Apr 29 08:06 pgsql14.6
drwxr-xr-x. 2 root root  6 Apr 11  2018 sbin
drwxr-xr-x. 5 root root 49 Oct  5  2018 share
drwxr-xr-x. 2 root root  6 Apr 11  2018 src
[root@localhost local]# rm -rf pgsql
[root@localhost local]# ln -s /usr/local/pgsql14.11 /usr/local/pgsql
[root@localhost local]# ll
total 0
drwxr-xr-x. 2 root root  6 Apr 11  2018 bin
drwxr-xr-x. 2 root root  6 Apr 11  2018 etc
drwxr-xr-x. 2 root root  6 Apr 11  2018 games
drwxr-xr-x. 2 root root  6 Apr 11  2018 include
drwxr-xr-x. 2 root root  6 Apr 11  2018 lib
drwxr-xr-x. 2 root root  6 Apr 11  2018 lib64
drwxr-xr-x. 2 root root  6 Apr 11  2018 libexec
lrwxrwxrwx  1 root root 21 May  2 04:38 pgsql -> /usr/local/pgsql14.11
drwxr-xr-x  6 root root 56 May  2 04:33 pgsql14.11
drwxr-xr-x  6 root root 56 Apr 29 08:06 pgsql14.6
drwxr-xr-x. 2 root root  6 Apr 11  2018 sbin
drwxr-xr-x. 5 root root 49 Oct  5  2018 share
drwxr-xr-x. 2 root root  6 Apr 11  2018 src
[root@localhost local]#

4.重启pg数据库服务

重启前:

[root@localhost local]# psql postgres postgres
psql (14.11, server 14.6)
Type "help" for help.

postgres=# select version();
                                                 version
---------------------------------------------------------------------------------------------------------
 PostgreSQL 14.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
(1 row)

postgres=#

重启后:

[root@localhost local]# su - postgres
Last login: Tue Apr 30 06:02:50 UTC 2024 on pts/0
[postgres@localhost ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
[postgres@localhost ~]$ pg_ctl start
server started
[postgres@localhost ~]$ psql
psql (14.11)
Type "help" for help.

postgres=# select version();
                                                 version
----------------------------------------------------------------------------------------------------------
 PostgreSQL 14.11 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
(1 row)

postgres=#

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值