在 Cent OS 上安装 postgres

在 Cent OS 上安装 postgres

我在 Cent OS 7.2 上重新安装 postgres 时遇到了困难。以下是我尝试过的。

  • 去了postgres 的 YUM 仓库
  • 在我的计算机上为 RPM 文件创建了一个临时文件夹
  • 做过wget https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-2.noarch.rpm
  • 接下来我ran rpm -ivh filename

但我得到的只是package pgdg-centos95-9.5-2.noarch is already installed

我对错误消息没有异议,但是当我使用以下命令安装 postgres 组件时。

sudo yum install postgresql95-server.x86_64 postgresql95-contrib.x86_64 postgresql95-devel.x86_64

它列出了与我下载的 rpm 不同的详细信息,即 9.5.1-1PGDG.rhel7

Dependencies Resolved

==============================================================================================================================================================================================
 Package                                              Arch                                   Version                                             Repository                              Size
==============================================================================================================================================================================================
Installing:
 postgresql95-contrib                                 x86_64                                 9.5.1-1PGDG.rhel7                                   pgdg95                                 526 k
 postgresql95-devel                                   x86_64                                 9.5.1-1PGDG.rhel7                                   pgdg95                                 1.7 M
 postgresql95-server                                  x86_64                                 9.5.1-1PGDG.rhel7                                   pgdg95                                 4.1 M
Installing for dependencies:
 postgresql95                                         x86_64                                 9.5.1-1PGDG.rhel7                                   pgdg95                                 1.3 M
 postgresql95-libs                                    x86_64                                 9.5.1-1PGDG.rhel7                                   pgdg95                                 218 k

Transaction Summary
==============================================================================================================================================================================================

当我继续安装时,所有软件包都出现 404 错误消息。

No Presto metadata available for pgdg95
postgresql95-9.5.1-1PGDG.rhel7 FAILED                                          
https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/postgresql95-9.5.1-1PGDG.rhel7.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found    ]  0.0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

postgresql95-devel-9.5.1-1PGDG FAILED                                          
https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/postgresql95-devel-9.5.1-1PGDG.rhel7.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found 0.0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.
postgresql95-contrib-9.5.1-1PG FAILED                                          
https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/postgresql95-contrib-9.5.1-1PGDG.rhel7.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: download.postgresql.org; Temporary failure in name resolution"
Trying other mirror.
postgresql95-libs-9.5.1-1PGDG. FAILED                                          
https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/postgresql95-libs-9.5.1-1PGDG.rhel7.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found  0.0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.
postgresql95-server-9.5.1-1PGD FAILED                                          
https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/postgresql95-server-9.5.1-1PGDG.rhel7.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found0.0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.

我在这里做错了什么,为什么 postgres 没有从我下载的 rpm 中安装。我假设问题在于 rpm 版本不匹配。

答案1

显然,我所做的修复是相当蛮力的,可能很愚蠢,但无论如何它都有效。

我做到了sudo find / -iname "pgdg95"

对列出的所有文件夹和文件运行 rm -rf。

重复上述步骤,安装成功。

答案帮助我启动并运行它。还必须更改 hba.conf。

相关内容