centos安装postgis

本文详细介绍了如何在CentOS系统上安装PostgreSQL数据库,并配置PostGIS扩展以支持地理空间数据处理。包括安装步骤、配置监听地址、设置密码验证等关键环节。

 
step 1
 
yum localinstall https://download.postgresql.org/pub/repos/yum/9.2/redhat/rhel-7-x86_64/pgdg-centos92-9.2-2.noarch.rpm
 
step 2
 
yum install gd gd-devel libtool* autoconf* readline
 
# vi /etc/yum.repos.d/CentOS-Base.repo
 
[base] 和[updates] 区段添加:exclude=postgresql*
 
yum list postgresql*检查postgresql版本是否正确 包含postgresql92所有安装包
 
yum postgresql92-devel postgresql92-contrib postgresql92.server
 
/usr/pgsql-9.2/bin/postgresql92-setup initdb
 
step 3
 
vi /var/lib/pgsql/9.4/data/postgresql.conf
 
去掉
 
listen_addresses
 
port
 
password前面的#
 
并修改
 
listen_addresses ='*'
 
vi /var/lib/pgsql/9.4/data/pg_hba.conf
 
修改
 
# IPv4 local connections:
 
host    all             all             127.0.0.1/32            md5
 
host    all             all             0。0.0.0/0              password
 
# IPv6 local connections:
 
host    all             all             ::1/128                 trust
 
:wq
 
 
yum -y install epel-release
 
yum install libxml2-devel
 
yum install geos-devel
 
yum install proj-devel
 
yum install gdal-devel
 
 
step 4
 
下载postgis 建议版本为2.1.9dev
 
解压后进入目录tar -zxf gostgis*
 
./ configure --with-pgconfig=/
 
make
 
make install
 
 
step 5
 
#su  postgres   
 
-bash-3.2$psql -U postgres   
 
postgres=#alter user postgres with password 'new password';
 
CREATE EXTENSION postgis;
 
连接数据库尝试插入geometry类型的数据
 
 
step 6
 
倒入导出数据库
 
导入:psql -U postgres(用户名)  数据库名(缺省时同用户名) < /data/dum.sql
 
导出:pg_dump -h localhost -U postgres(用户名) 数据库名(缺省时同用户名)   >/data/dum.sql

转载于:https://www.cnblogs.com/Micang/p/8659327.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值