You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

RHEL7环境下Greenplum4.3.1.9安装PostGIS扩展失败求助

解决Greenplum 4.3.1.9在RHEL7上安装PostGIS扩展失败的问题

你在RHEL7服务器上安装Greenplum的PostGIS扩展时碰到了rpm解压失败的问题,核心错误是cpio: open error,先把你提供的完整错误日志整理出来:

-bash-4.2$ gppkg -i postgis-ossv2.0.3_pv2.0.1_gpdb4.3orca-rhel5-x86_64.gppkg
20180116:16:15:14:011874 gppkg:Mongo1:gpadmin-[INFO]:-Starting gppkg with args: -i postgis-ossv2.0.3_pv2.0.1_gpdb4.3orca-rhel5-x86_64.gppkg
20180116:16:15:15:011874 gppkg:Mongo1:gpadmin-[INFO]:-Installing package postgis-ossv2.0.3_pv2.0.1_gpdb4.3orca-rhel5-x86_64.gppkg
20180116:16:15:15:011874 gppkg:Mongo1:gpadmin-[INFO]:-Validating rpm installation cmdStr='rpm --test -i /data/greenplum/.tmp/postgis-2.0.3-2.x86_64.rpm /data/greenplum/.tmp/geos-3.3.8-1.x86_64.rpm /data/greenplum/.tmp/proj-4.8.0-1.x86_64.rpm --dbpath /data/greenplum/share/packages/database --prefix /data/greenplum'
20180116:16:15:16:011874 gppkg:Mongo1:gpadmin-[INFO]:-Installing postgis-ossv2.0.3_pv2.0.1_gpdb4.3orca-rhel5-x86_64.gppkg locally
20180116:16:15:16:011874 gppkg:Mongo1:gpadmin-[INFO]:-Validating rpm installation cmdStr='rpm --test -i /data/greenplum/.tmp/postgis-2.0.3-2.x86_64.rpm /data/greenplum/.tmp/geos-3.3.8-1.x86_64.rpm /data/greenplum/.tmp/proj-4.8.0-1.x86_64.rpm --dbpath /data/greenplum/share/packages/database --prefix /data/greenplum'
20180116:16:15:16:011874 gppkg:Mongo1:gpadmin-[INFO]:-Installing rpms cmdStr='rpm -i /data/greenplum/.tmp/postgis-2.0.3-2.x86_64.rpm /data/greenplum/.tmp/geos-3.3.8-1.x86_64.rpm /data/greenplum/.tmp/proj-4.8.0-1.x86_64.rpm --dbpath /data/greenplum/share/packages/database --prefix=/data/greenplum'
20180116:16:15:17:011874 gppkg:Mongo1:gpadmin-[CRITICAL]:-Error occurred: non-zero rc: 3 Command was: 'rpm -i /data/greenplum/.tmp/postgis-2.0.3-2.x86_64.rpm /data/greenplum/.tmp/geos-3.3.8-1.x86_64.rpm /data/greenplum/.tmp/proj-4.8.0-1.x86_64.rpm --dbpath /data/greenplum/share/packages/database --prefix=/data/greenplum' rc=3, stdout='', stderr='error: unpacking of archive failed on file /data/greenplum/lib/libproj.a;5a5dd7bd: cpio: open error: proj-4.8.0-1.x86_64: install failed error: unpacking of archive failed on file /data/greenplum/lib/libgeos-3.3.8.so;5a5dd7bd: cpio: open error: geos-3.3.8-1.x86_64: install failed error: unpacking of archive failed on file /data/greenplum/bin/pgsql2shp;5a5dd7bd: cpio: open error: postgis-2.0.3-2.x86_64: install failed'

这个问题的本质是rpm无法将文件写入到/data/greenplum/lib和/data/greenplum/bin目录,下面是具体的排查和解决步骤:

1. 检查目标目录的权限与归属

首先确认gpadmin用户对Greenplum安装目录有完整的读写权限:

# 查看目录的权限和归属信息
ls -ld /data/greenplum /data/greenplum/lib /data/greenplum/bin

如果目录归属不是gpadmin:gpadmin,执行以下命令修正:

chown -R gpadmin:gpadmin /data/greenplum

如果权限不足,调整目录权限:

chmod -R 755 /data/greenplum/lib /data/greenplum/bin

2. 清理gppkg临时文件

gppkg会在/data/greenplum/.tmp目录下临时存放解压的rpm包,可能之前的临时文件存在损坏,先清理再重新安装:

rm -rf /data/greenplum/.tmp/*

然后重新执行安装命令:

gppkg -i postgis-ossv2.0.3_pv2.0.1_gpdb4.3orca-rhel5-x86_64.gppkg

3. 检查SELinux是否阻止写入

RHEL7默认开启SELinux,可能会拦截rpm对指定目录的写入操作,临时关闭SELinux测试:

setenforce 0

如果安装成功,说明是SELinux的限制导致的,可以选择:

  • 永久关闭SELinux(编辑/etc/selinux/config,设置SELINUX=disabled,重启服务器生效)
  • 为Greenplum目录添加SELinux规则(更安全的长期方案)

4. 检查包的系统兼容性

注意你使用的是RHEL5版本的gppkg包(文件名中的rhel5标识),但你的服务器是RHEL7,跨系统版本的包可能存在底层依赖兼容性问题。建议尝试寻找适配RHEL7的Greenplum 4.3.x对应PostGIS gppkg包,如果官方没有提供,可以考虑手动编译PostGIS并适配Greenplum环境。

5. 手动安装rpm包排查细节

如果上面的步骤都无效,可以手动解压gppkg包,直接安装rpm并查看详细日志,定位更具体的失败原因:

# 解压gppkg包到临时目录
gppkg --extract postgis-ossv2.0.3_pv2.0.1_gpdb4.3orca-rhel5-x86_64.gppkg /tmp/postgis_extract
# 进入解压目录,执行rpm安装并查看详细日志
cd /tmp/postgis_extract
rpm -ivv *.rpm --dbpath /data/greenplum/share/packages/database --prefix=/data/greenplum

详细日志会告诉你更具体的失败原因,比如是否是文件系统已满、目标目录不存在等。

内容的提问来源于stack exchange,提问作者Sachin Kr. Saini

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:02:17