在Cent OS上安装postgres

我很难得到在OS OS 7.2重新安装postgres。这是我的尝试。

  • 去了Postgres的YUM回购
  • 在我的机器上为RPM文件创build了一个临时文件夹
  • 没有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版本不匹配是问题。

显然我所做的修复是非常暴力,可能是愚蠢的,但无论如何它的作品。

我做了sudo find / -iname "pgdg95"

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

重复上面列出的步骤,它安装正常。

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