无法在 Centos 机器上安装 PostgreSQL 服务器。
我只是添加了 PostgreSQL 官方仓库
rpm -ivh https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-3.noarch.rpm
然后跑了
yum install yum install postgresql95-server
这是我收到的错误:
Error unpacking rpm package postgresql95-server-9.5.9-1PGDG.rhel6.x86_64
error: unpacking of archive failed on file /var/lib/pgsql: cpio: stat
我已经尝试过 PostgreSQL 9.4、9.5、9.6,它们都有同样的错误。
此 repo 中的其他软件包安装也没有任何问题
有人知道这里的问题是什么吗?
答案1
尝试在本地下载软件包,然后安装。但请注意下载的版本。
引自https://www.postgresql.org/download/linux/redhat/
发行版本RHEL/CentOS/SL/OL 7 9.2RHEL/CentOS/SL/OL 6 8.4RHEL/CentOS/SL/OL 5 8.1
抱歉,上面的格式不对。这是我用我们这里有限的工具能做的最好的事情。
答案2
假设您是 root 用户并且没有任何 selinux 问题,那么在 yum 尝试安装 postgres 的系统上可能有一些先前剩余的文件。
答案3
我刚刚在干净的 C6 安装上按照您说的做了,并且运行良好:
[me@angband ~]$ sudo rpm -ivh https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-3.noarch.rpm
Retrieving https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-3.noarch.rpm
warning: /var/tmp/rpm-tmp.YH2GD1: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing... ########################################### [100%]
1:pgdg-centos95 ########################################### [100%]
[me@angband ~]$ sudo yum install postgresql95-server
[...]
Resolving Dependencies
--> Running transaction check
---> Package postgresql95-server.x86_64 0:9.5.9-1PGDG.rhel6 will be installed
--> Processing Dependency: postgresql95-libs(x86-64) = 9.5.9-1PGDG.rhel6 for package: postgresql95-server-9.5.9-1PGDG.rhel6.x86_64
--> Processing Dependency: postgresql95(x86-64) = 9.5.9-1PGDG.rhel6 for package: postgresql95-server-9.5.9-1PGDG.rhel6.x86_64
--> Processing Dependency: postgresql95 = 9.5.9-1PGDG.rhel6 for package: postgresql95-server-9.5.9-1PGDG.rhel6.x86_64
--> Running transaction check
---> Package postgresql95.x86_64 0:9.5.9-1PGDG.rhel6 will be installed
---> Package postgresql95-libs.x86_64 0:9.5.9-1PGDG.rhel6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================
Package Arch Version Repository Size
================================================================================================================
Installing:
postgresql95-server x86_64 9.5.9-1PGDG.rhel6 pgdg95 4.5 M
Installing for dependencies:
postgresql95 x86_64 9.5.9-1PGDG.rhel6 pgdg95 1.3 M
postgresql95-libs x86_64 9.5.9-1PGDG.rhel6 pgdg95 208 k
Transaction Summary
================================================================================================================
Install 3 Package(s)
Total download size: 6.0 M
Installed size: 24 M
Is this ok [y/N]: y
[...]
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : postgresql95-libs-9.5.9-1PGDG.rhel6.x86_64 1/3
Installing : postgresql95-9.5.9-1PGDG.rhel6.x86_64 2/3
Installing : postgresql95-server-9.5.9-1PGDG.rhel6.x86_64 3/3
Verifying : postgresql95-libs-9.5.9-1PGDG.rhel6.x86_64 1/3
Verifying : postgresql95-9.5.9-1PGDG.rhel6.x86_64 2/3
Verifying : postgresql95-server-9.5.9-1PGDG.rhel6.x86_64 3/3
Installed:
postgresql95-server.x86_64 0:9.5.9-1PGDG.rhel6
Dependency Installed:
postgresql95.x86_64 0:9.5.9-1PGDG.rhel6 postgresql95-libs.x86_64 0:9.5.9-1PGDG.rhel6
Complete!
所以我不认为你正在尝试做任何疯狂的事情,最有可能的是 RPM 在传输过程中以某种方式被更改,或者你的 RPM 环境无法正常工作。你是否使用任何类型的代理进行 Web 访问,并确认错误在 之后仍然存在yum clean all
?你是否可以尝试安装一个非常小且无害的 RPM,比如yum install rcs
,看看它是否也会失败?