centos安装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

posted on 2018-03-27 18:52  米仓山下  阅读(550)  评论(0编辑  收藏  举报

导航