linux下搭建postgresql、postgis、pg_pathman环境步骤详解
来源:互联网 发布:mac airplay连接电视 编辑:程序博客网 时间:2024/06/14 07:36
操作系统:centOS6.6
安装postgreSQL9.6.2
安装命令:
./postgresql-9.6.3-2-linux-x64.run
之后按照图形界面操作安装,语言选择zh_CN UTF-8
安装geos-3.6.0(会报错,暂时不用管)
安装命令:
tar xjvfgeos-3.6.0.tar.bz2
cd geos-3.6.0
./configure –prefix=/opt/geos
make
make install
安装proj-4.9.3
安装命令:
tar zxvf proj-4.9.3.tar.gz
cd proj-4.9.3
./configure –prefix=/opt/proj
make
make install
安装gdal-2.1.2
安装命令:
yum install gcc-c++
tar zxvf gdal-2.1.2.tar.gz
cd gdal-2.1.2
./configure –prefix=/opt/gdal
make
make install
删除geos相关的文件夹
cd /opt
rm –rf geos
rm –rf geos-3.6.0
重新安装geos-3.6.0,步骤如上
安装postgis
安装命令:
export LD_LIBRARY_PATH=/opt/PostgreSQL/9.6/lib
export PATH=/opt/PostgreSQL/9.6/bin:$PATH
export MANPATH=/opt/PostgreSQL/9.6/share/man:$MANPATH
tar zxvf postgis-2.3.2.tar.gz
cd postgis-2.3.2
./configure -prefix=/opt/postgis
报错如下:
checking for xml2-config... no
configure: error: could not find xml2-config from libxml2within the current path. You may need to try re-running configure with a--with-xml2config parameter.
checking for xml2-config... no
configure: error: could not find xml2-config from libxml2within the current path. You may need to try re-running configure with a--with-xml2config parameter.
检查libxml2的安装情况:
rpm -qa |grep libxml2
重新安装libxml2和libxml2-devel包(需要联网)
yum install libxml2
yum install libxml2-devel -y
安装完之后查找xml2-config文件是否存在:
find / -name "xml2-config"
如果输出结果如下表示成功:
/usr/bin/xml2-config
继续执行如下命令:
./configure --prefix=/opt/postgis/--with-pgconfig=/opt/PostgreSQL/9.6/bin/pg_config--with-geosconfig=/opt/geos/bin/geos-config --with-projdir=/opt/proj/--with-gdalconfig=/opt/gdal/bin/gdal-config--with-xml2config=/usr/bin/xml2-config
make
make install
打开postgresql终端执行
SELECT name,default_version,installed_version FROM pg_available_extensions WHERE name LIKE'postgis%' ;
执行命令:
cp/opt/geos/lib/libgeos_c.so.1 /opt/PostgreSQL/9.6/lib
执行命令:
cp/opt/proj/lib/libproj.so.12 /opt/PostgreSQL/9.6/lib
执行命令:
cp /opt/gdal/lib/libgdal.so.20 /opt/PostgreSQL/9.6/lib
创建postgis扩展
安装pg_pathman
安装命令:
cd /opt
unzippg_pathman-1.2.1.zip
export PATH=/opt/PostgreSQL/9.6/bin:$PATH
cd pg_pathman-1.2.1
cp -r/opt/PostgreSQL/9.6/include/openssl /usr/include/
cp -r/opt/PostgreSQL/9.6/include/gssapi /usr/include/
make USE_PGXS=1
make USE_PGXS=1install
cd/opt/PostgreSQL/9.6/data/
vimpostgresql.conf
#将shared_preload_libraries注释取消,将下面变量赋值进去
shared_preload_libraries= 'pg_pathman,pg_stat_statements'
按esc退出,:wq!保存退出!
重启数据库服务:
service postgresql-9.6 restart创建pg_pathman扩展
开启远程访问:
vi /opt/PostgreSQL/9.6/data/postgresql.conf
修改#listen_addresses= 'localhost' 为 listen_addresses='*'
当然,此处‘*’也可以改为任何你想开放的服务器IP
信任远程连接
vi /opt/PostgreSQL/9.6/data/pg_hba.conf
修改如下内容,信任指定服务器连接关闭防火墙
service iptables stop
chkconfig iptables off
service iptables status重启数据库服务:
servicepostgresql-9.6 restart
- linux下搭建postgresql、postgis、pg_pathman环境步骤详解
- 在Linux环境下编译安装配置PostGIS/PostgreSQL全过程
- Linux环境下PostgreSQL与PostGIS的安装与配置
- PostgreSQL+PostGIS+OpenStreeMap+GeoServer环境搭建
- liunx环境下源码安装PostgreSQL+PostGIS
- linux下postgresql数据库debug环境搭建
- webgis实践之数据库linux下 Postgresql + postgis + pgrouting安装
- Linux下Gtest测试环境搭建步骤
- linux下搭建hadoop环境步骤
- linux + postgresql + postgis 源码 安装
- myeclipse+tomcat+postgresql搭建服务器环境步骤
- 【Linux】linux环境下java环境搭建步骤
- linux 环境搭建步骤
- Linux环境下搭建php开发环境的操作步骤
- 【PostgreSQL】linux环境下的PostgreSQL安装
- Linux下搭建LAMP环境详解
- linux环境下安装postgresql
- Linux(Ubuntu)下PostGIS+Postgresql的安装与配置(下)
- java菜鸟学习之路之JDBC连接Oracle数据库
- mysql 数据库
- python -文件操作
- Input中value与显示不一致
- Android Wi-Fi Deauthenticated Reason Code(Android)
- linux下搭建postgresql、postgis、pg_pathman环境步骤详解
- Java中ArrayList和LinkedList区别
- Android View的事件分发机制和滑动冲突解决方案
- linux shell$()的简单用法
- vue与element-ui的结合,脚手架第一步【vue日记】
- 隐马尔科夫模型-----二
- Java语言基础{Java_se(06)}-static修饰符-this关键词-单利设计模式-super关键词-继承-方法覆盖-多态-final修饰符-
- 开始学习Hibernate框架遇到的空指针问题
- Azkaban安装部署