PostgreSQL 安装部署系列:使用YUM 方式在Centos 7.9 安装指定 PostgreSQL -15版本数据库

一、前言

     千里之行始于足下,想学习一门数据库,首先要从安装部署开始,先拥有一套属于自己的学习测试库。为了更好的学习该数据库,可以选择一个在企业界使用率比较普及的操作系统,选择稳定版本的操作系统;如果不是为了研究数据库各版本软件差异,不是为了钻研最新版本数据库的新特性,建议选择一款比较新且稳定成熟的数据库版本软件。

       PostGreSQL作为一款优秀的开源数据库,在国内外广受欢迎,被用于很多行业,在国内外也有很多的PG fans。

       PostGreSQL安装的方式有多种,比如在Linux或MAC操作系统上,可以选择yum、二进制、源码方式安装。

       相对于Windows操作系统,PostGreSQL更多安装在Linux等操作系统上,所以对于Windows如何安装PostGreSQL不在本系列讨论范围内。

       作为PostGreSQL安装部署系列篇,本次讲解如何在Linux上使用YUM来安装,本次选择采用Centos 7.9操作系统来验证。

接下来,安装部署,走起。

二、前期准备

2.1 配置YUM源

      如果你的Linux能联网,建议选择配置一个YUM源,比如选择使用比较普遍的阿里yum源。如何配置YUM源,大家可以搜下网络介绍,本次不作为分享内容,大家可以自行搜索部署。

2.2 下载软件

登录PostGreSQL官网地址:https://www.postgresql.org/download/,进入到如下界面。

image20231228144116495.png

参照上图,选择对应的操作系统,本次选择Linux,然后选择对应的Linux的发行版,本次选择Red Hat/Rocky/AlmaLinux发行版,如下所示。

image20231228144533320.png

然后进入到https://www.postgresql.org/download/linux/redhat/对应的页面,然后选择相应的数据库版本、对应的操作系统版本、对应的架构模式,本次选择PostGreSQL 15版本,如下所示。

image20231228144801254.png

三、安装部署

根据https://www.postgresql.org/download/linux/redhat/所填写内容,拷贝相应命令分别执行。

3.1 安装仓库RPM包

# 使用root用户执行如下命令:
[root@host19c-node1 ~]# sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

-- 上述命令执行结果如下:
pgdg-redhat-repo-latest.noarch.rpm                                                                                                                                                                                    | 9.0 kB  00:00:00     
Examining /var/tmp/yum-root-CYlXMy/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-35PGDG.noarch
Marking /var/tmp/yum-root-CYlXMy/pgdg-redhat-repo-latest.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-35PGDG will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                  Arch                                           Version                                               Repository                                                               Size
=============================================================================================================================================================================================================================================
Installing:
 pgdg-redhat-repo                                         noarch                                         42.0-35PGDG                                           /pgdg-redhat-repo-latest.noarch                                          13 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install  1 Package

Total size: 13 k
Installed size: 13 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
R-java-3.6.0-1.el7.x86_64 has missing requires of java-headless
ant-1.9.4-2.el7.noarch has missing requires of java-devel >= ('0', '1.5.0', None)
rlwrap-0.43-2.el7.x86_64 has missing requires of /usr/bin/python3.6
  Installing : pgdg-redhat-repo-42.0-35PGDG.noarch                                                                                                                                                                                       1/1 
  Verifying  : pgdg-redhat-repo-42.0-35PGDG.noarch                                                                                                                                                                                       1/1 

Installed:
  pgdg-redhat-repo.noarch 0:42.0-35PGDG                                                                                                                                                                                                      

Complete!

image20231227160156998.png

上述命令执行完毕后,可以使用yum search postgresql命令来查看安装了哪些PostGreSQL数据库相关软件。

# 使用yum search postgresql命令查看相关数据库软件
[root@host19c-node1 ~]# yum search postgresql
-- 上述命令执行结果如下:
pgdg-common/7/x86_64/signature                                                                                                                                                                                        |  198 B  00:00:00     
pgdg-common/7/x86_64/signature                                                                                                                                                                                        | 2.9 kB  00:00:00 !!! 
pgdg11/7/x86_64/signature                                                                                                                                                                                             |  198 B  00:00:00     
pgdg11/7/x86_64/signature                                                                                                                                                                                             | 3.6 kB  00:00:00 !!! 
pgdg12/7/x86_64/signature                                                                                                                                                                                             |  198 B  00:00:00     
pgdg12/7/x86_64/signature                                                                                                                                                                                             | 3.6 kB  00:00:00 !!! 
pgdg13/7/x86_64/signature                                                                                                                                                                                             |  198 B  00:00:00     
Retrieving key from
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

尚雷_TechTalk01

感谢您的鼓励,我会再接再厉。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值