`
- 浏览:
690575 次
-
CentOS安装PostGIS最方便的方法是用PostgreSQL源加上EPEL源,直接yum安装,无痛解决依赖问题(源码安装时遇到的依赖问题会让人抓狂的)。
系统环境:
CentOS 6.4 x64
要求:
PostgreSQL安装到 /postgresql 目录,数据目录为 /postgresql/data。
1.使用PostgreSQL源
参考http://wiki.postgresql.org/wiki/YUM_Installation
在http://yum.postgresql.org/repopackages.php页面选择相应系统的rpm包,CentOS
6.x 可直接 wget http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
rpm -ivh pgdg-centos93-9.3-1.noarch.rpm
vim /etc/yum.repos.d/CentOS-Base.repo
在 [base] 和 [updates] 区域中加入一行
exclude=postgresql*
yum makecache
2.使用EPEL源
由于PostGIS所依赖的包比较多,有些在CentOS官方源中没有,所以需要使用EPEL源。
具体步骤参考上一篇blog。
3.安装PostgreSQL
yum list postgres*
由于yum安装无法指定软件安装目录,这里使用软链接来实现指定PostgreSQL安装目录。
yum安装PostgreSQL的默认路径为/usr/pgsql-9.3
mkdir /postgresql
mkdir /postgresql/data
ln -s /postgresql /usr/pgsql-9.3
yum install postgresql93-server
4.配置PostgreSQL参数,初始化数据库
vim ~/.bash_profile
PGHOME=/postgresql
PGDATA=/postgresql/data
PGPORT=5432
export PGHOME PGDATA PGPORT
$PGHOME/bin/initdb -D $PGDATA
5.安装PostGIS
yum list postgis*
yum install postgis2_93.x86_64 postgis2_93-client.x86_64pos postgis2_93-devel.x86_64 postgis2_93-docs.x86_64 postgis2_93-utils.x86_64
6.修改pg_hba.conf和postgresql.conf配置
7.加载PostGIS插件
查看PostGIS相关文件
# ll $PGHOME/share/extension/
总用量 25936
-rw-r--r--. 1 root root 332 10月 9 17:11 plpgsql--1.0.sql
-rw-r--r--. 1 root root 179 10月 9 17:11 plpgsql.control
-rw-r--r--. 1 root root 381 10月 9 17:11 plpgsql--unpackaged--1.0.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.0.0--2.1.1.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.0.1--2.1.1.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.0.2--2.1.1.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.0.3--2.1.1.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.0.4--2.1.1.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.1.0--2.1.1.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.1.0rc1--2.1.1.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.1.0rc2--2.1.1.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.1.0rc3--2.1.1.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.1.1--2.1.1next.sql
-rw-r--r--. 1 root root 597783 11月 9 04:02 postgis--2.1.1next--2.1.1.sql
-rw-r--r--. 1 root root 4211501 11月 9 04:02 postgis--2.1.1.sql
-rw-r--r--. 1 root root 185 11月 9 04:02 postgis.control
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.0.0--2.1.1.sql
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.0.1--2.1.1.sql
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.0.2--2.1.1.sql
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.0.3--2.1.1.sql
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.0.4--2.1.1.sql
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.1.0--2.1.1.sql
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.1.0rc1--2.1.1.sql
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.1.0rc2--2.1.1.sql
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.1.0rc3--2.1.1.sql
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.1.1--2.1.1next.sql
-rw-r--r--. 1 root root 979837 11月 9 04:02 postgis_tiger_geocoder--2.1.1next--2.1.1.sql
-rw-r--r--. 1 root root 1073180 11月 9 04:02 postgis_tiger_geocoder--2.1.1.sql
-rw-r--r--. 1 root root 193 11月 9 04:02 postgis_tiger_geocoder.control
-rw-r--r--. 1 root root 8558 11月 9 04:02 postgis_tiger_geocoder--unpackaged--2.1.1.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.0.0--2.1.1.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.0.1--2.1.1.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.0.2--2.1.1.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.0.3--2.1.1.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.0.4--2.1.1.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.1.0--2.1.1.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.1.0rc1--2.1.1.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.1.0rc2--2.1.1.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.1.0rc3--2.1.1.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.1.1--2.1.1next.sql
-rw-r--r--. 1 root root 309299 11月 9 04:02 postgis_topology--2.1.1next--2.1.1.sql
-rw-r--r--. 1 root root 303625 11月 9 04:02 postgis_topology--2.1.1.sql
-rw-r--r--. 1 root root 169 11月 9 04:02 postgis_topology.control
-rw-r--r--. 1 root root 9775 11月 9 04:02 postgis_topology--unpackaged--2.1.1.sql
-rw-r--r--. 1 root root 93819 11月 9 04:02 postgis--unpackaged--2.1.1.sql
# ll $PGHOME/share/contrib/postgis-2.1/
总用量 5972
-rw-r--r--. 1 root root 1214 11月 9 04:02 legacy_gist.sql
-rw-r--r--. 1 root root 2556 11月 9 04:02 legacy_minimal.sql
-rw-r--r--. 1 root root 54475 11月 9 04:02 legacy.sql
-rw-r--r--. 1 root root 65668 11月 9 04:02 postgis_comments.sql
-rwxr-xr-x. 1 root root 147813 11月 9 04:02 postgis_restore.pl
-rw-r--r--. 1 root root 206659 11月 9 04:02 postgis.sql
-rw-r--r--. 1 root root 161237 11月 9 04:02 postgis_upgrade_20_21.sql
-rw-r--r--. 1 root root 161237 11月 9 04:02 postgis_upgrade_21_minor.sql
-rw-r--r--. 1 root root 67301 11月 9 04:02 raster_comments.sql
-rw-r--r--. 1 root root 5775 11月 9 04:02 rtpostgis_legacy.sql
-rw-r--r--. 1 root root 269778 11月 9 04:02 rtpostgis.sql
-rw-r--r--. 1 root root 299364 11月 9 04:02 rtpostgis_upgrade_20_21.sql
-rw-r--r--. 1 root root 299364 11月 9 04:02 rtpostgis_upgrade_21_minor.sql
-rw-r--r--. 1 root root 3593962 11月 9 04:02 spatial_ref_sys.sql
-rw-r--r--. 1 root root 14395 11月 9 04:02 topology_comments.sql
-rw-r--r--. 1 root root 289150 11月 9 04:02 topology.sql
-rw-r--r--. 1 root root 289010 11月 9 04:02 topology_upgrade_21_minor.sql
-rw-r--r--. 1 root root 14401 11月 9 04:02 uninstall_legacy.sql
-rw-r--r--. 1 root root 38592 11月 9 04:02 uninstall_postgis.sql
-rw-r--r--. 1 root root 68405 11月 9 04:02 uninstall_rtpostgis.sql
-rw-r--r--. 1 root root 1451 11月 9 04:02 uninstall_sfcgal.sql
-rw-r--r--. 1 root root 10684 11月 9 04:02 uninstall_topology.sql
加载PostGIS插件
# psql -d postgres -U postgres
psql (9.3.1)
输入 "help" 来获取帮助信息.
postgres=# \l
资料库列表
名称 | 拥有者 | 字元编码 | 校对规则 | Ctype | 存取权限
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 行记录)
postgres=# create database postgis ;
CREATE DATABASE
postgres=# \c postgis
您现在已经连线到数据库 "postgis",用户 "postgres".
postgis=# select * from pg_extension;
extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition
---------+----------+--------------+----------------+------------+-----------+--------------
plpgsql | 10 | 11 | f | 1.0 | |
(1 行记录)
postgis=# create extension postgis;
CREATE EXTENSION
postgis=# \dt
关联列表
架构模式 | 名称 | 型别 | 拥有者
----------+-----------------+--------+----------
public | spatial_ref_sys | 资料表 | postgres
(1 行记录)
postgis=# select count(*) from spatial_ref_sys ;
count
-------
3911
(1 行记录)
postgis=# \dn
架构模式列表
名称 | 拥有者
--------+----------
public | postgres
(1 行记录)
postgis=# create extension postgis_topology;
CREATE EXTENSION
postgis=# \dn
架构模式列表
名称 | 拥有者
----------+----------
public | postgres
topology | postgres
(2 行记录)
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
postgresql14加postgis3.2在centos离线编译安装
内有postgres和postgis的软件及其依赖包,还有一个无脑部署安装文档,亲自用虚拟机安装无网centos测过
基于Centos7 x64 操作系统 ,开源数据PostgreSQL+PostGIS 数据环境安装文档
centos nginx+mysql5.7+redis+postgresql12+postgis 安装包
主要介绍了CentOS7使用yum安装PostgreSQL和PostGIS的方法,非常不错,具有一定的参考借鉴价值,需要的朋友可以参考下
可利用里面文件离线在linux(centos)操作系统中顺利安装部署,本资源可在半小时内完成各种配置,简单方便,并通过了几台服务器环境测试。 基于pg库进行地理空间数据存储的开源数据库技术方案,只有正确安装改库...
libzstd-1.5.5-1.el7.x86_64.rpm libicu-50.2-4.el7_7.x86_64.rpm postgresql15-15.3-1PGDG.rhel7.x86_64.rpm postgresql15-libs-15.3-1PGDG.rhel7....CentOS7 下 PostgreSQL15 离线安装 及 libzstd ,libicu 依赖包;
centos7下Postgres13安装包带依赖,附安装脚本
试用系统:Centos7.4、Redhat7.4、Oracle Linux 7.4 组件版本: - JDK: 1.8 - Oracle: 12.2.0.1 - PostgreSQL: 10.6 - PostGIS:2.5 - Redis: 5.05 - RabbitMQ: 3.7.8 - Erlang: 21.1 - Mysql: Percona Server 5.7 x...
详细描述了在Linux下编译postgresql和postgis源码的过程
postgresql11-15和postgis30_11的rpm
想学习openguass数据库的人可以用
压缩包中包含postgresql12-docker19-postgis三个组件,每个组件都是当下比较常用的版本,并且其中还包含了现在比较流行的postgis,目前只有一个docker的安装文档,其他两个我这边还没总结,有需要的先自行百度一下...
下载并解压安装包后,在目录下执行rpm -ivh --force --nodeps *.rpm即可完成postgreSql12的安装
postgresql13 + postgis + timescaledb完整安装包,包含安装启动所需要的的依赖,完全离线安装,postgis和timescaledb可选安装。
基于centos7的geos 3.8.1库(含库文件和头文件),支持centos7.0以后的版本。GEOS的前身是JTS,JTS提供了全功能的,强大的空间操作和空间判断。 后来PostGIS缺少一套完整的空间查询操作,于是就将JTS移植成为C++版本,...
基于centos7的proj6库(含库文件和头文件),支持centos7.0以后的版本。Proj是开源 GIS 最著名的地图投影库,GRASS GIS、MapServer、PostGIS、Thuban、OGDI、Mapnik、TopoCad、GDAL/OGR 等软件的投影都直接或间接的...
linxu离线安装postgis时可能需要此包
本包为在centos7环境中对greenplum6.7+postgis2.1.5编译后的包,可以直接部署使用,方便大家。