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

Ubuntu 18.04安装postgresql-13-postgis-3缺libgdal20依赖如何解决

安装故障解决方案

原因说明

报错核心原因是postgresql-13-postgis-3依赖的libgdal20库无法安装,通常是Ubuntu 18.04的universe软件仓库未启用,或者存在现有包版本冲突导致。

操作步骤

  • 第一步:启用universe仓库并更新源
sudo add-apt-repository universe
sudo apt update -y

如果之前添加过第三方GIS相关的PPA源,建议先删除对应源文件避免版本冲突:

sudo rm -f /etc/apt/sources.list.d/ubuntugis*.list
sudo apt update -y

如果存在被持有的破损包,先解除持有:

sudo apt-mark unhold $(sudo apt-mark showhold)
  • 第二步:手动安装基础依赖库
sudo apt install -y libgdal20 libgeos-c1v5 libproj12
  • 第三步:重新安装PostGIS相关包
sudo apt install -y postgresql-13 postgresql-13-postgis-3 postgresql-13-postgis-3-scripts postgresql-client-13

备选方案(上述步骤失败时使用)

如果依然存在依赖冲突,使用aptitude工具自动处理依赖关系:

sudo apt install -y aptitude
sudo aptitude install -y postgresql-13-postgis-3 postgresql-13-postgis-3-scripts

安装验证

安装完成后执行以下命令验证是否生效:

# 切换到postgres用户进入数据库
sudo -u postgres psql

在psql交互界面执行:

CREATE EXTENSION postgis;
SELECT postgis_version();

如果返回PostGIS的版本信息即代表安装成功。

内容的提问来源于stack exchange,提问作者Tek Kshetri

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.26 23:54:03