zoukankan      html  css  js  c++  java
  • CentOS7 安装Postgresql 11+ 源码编译安装Postgis-2.5.2

    ####安装Postgresql-11
    yum install zlib-devel gcc make
    groupadd postgres
    useradd -g postgres postgres
    passwd postgres
    mkdir -p /usr/local/postgresql
    chown -R postgres:postgres /usr/local/postgresql
    cd /usr/local/src/
    wget https://ftp.postgresql.org/pub/source/v11.3/postgresql-11.3.tar.gz
    tar -xzvf postgresql-11.3.tar.gz
    cd postgresql-11.3
    ./configure --prefix=/usr/local/postgresql --without-readline
    make && make install

    #安装contrib目录下的一些工具,是第三方组织的一些工具代码,建议安装
    cd contrib
    make && make install


    #初始化数据库
    initdb -D /data/postgresql/data

    #启动服务
    pg_ctl -D /data/postgresql/data -l /var/postgresql/logfile start

    ####安装Proj4

    wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz
    tar -xf proj-4.9.3.tar.gz
    cd proj-4.9.3
    ./configure --prefix=/usr/local/pgsql/plugin/proj
    make
    make install
    echo "/usr/local/pgsql/plugin/proj/lib" > /etc/ld.so.conf.d/proj-4.9.3.conf
    ldconfig

    ###安装GEOS

    wget http://download.osgeo.org/geos/geos-3.6.1.tar.bz2
    tar -jxf geos-3.6.1.tar.bz2
    cd geos-3.6.1
    ./configure --prefix=/usr/local/pgsql/plugin/geos
    make
    make install
    echo "/usr/local/pgsql/plugin/geos/lib" > /etc/ld.so.conf.d/geos-3.6.1.conf
    ldconfig

    ###安装GDAL

    wget http://download.osgeo.org/gdal/2.1.2/gdal-2.1.2.tar.gz
    tar -xf gdal-2.1.2.tar.gz
    cd gdal-2.1.2
    ./configure --prefix=/usr/local/pgsql/plugin/gdal
    make
    make install
    echo "/usr/local/pgsql/plugin/gdal/lib" > /etc/ld.so.conf.d/gdal-2.1.2.conf
    ldconfig


    ###安装PostGIS

    wget https://download.osgeo.org/postgis/source/postgis-2.5.2.tar.gz
    tar -xvzf postgis-2.5.2.tar.gz
    cd postgis-2.5.2
    ./configure --prefix=/usr/local/pgsql/plugin/postgis --with-pgconfig=/usr/local/postgresql/bin/pg_config --with-geosconfig=/usr/local/pgsql/plugin/geos/bin/geos-config --with-gdalconfig=/usr/local/pgsql/plugin/gdal/bin/gdal-config --with-projdir=/usr/local/pgsql/plugin/proj
    make
    make install

    ###安装fuzzystrmatch
    cd /usr/local/src/postgresql-11.3/contrib/fuzzystrmatch
    make && make install

    ###检查PostGiS是否安装成功

    #切换postgres用户
    su - postgres
    #登录PG数据库
    psql
    # 创建一个数据库
    create database postgis;
    #切换到postgis库中
    c postgis
    #显示一下扩展模块
    dx

    CREATE EXTENSION postgis;
    CREATE EXTENSION postgis_topology;
    CREATE EXTENSION fuzzystrmatch;
    CREATE EXTENSION postgis_tiger_geocoder;

  • 相关阅读:
    通过Maven简单搭建SSM框架
    javaWeb常用面试题
    到底什么是对象,什么是对象的引用?对象和对象的引用有那些区别?
    第二章 python中重要的数据结构(下)
    第一章 python中重要的数据结构(上)
    springboot 集成完整的swagger2
    JAVA -> 数据加密和解密 留存
    mac rar文件解压缩
    java 图片合成文字或者awt包下的对话框引入自定义字体库
    java中list或数组中随机子集工具类
  • 原文地址:https://www.cnblogs.com/EikiXu/p/11056707.html
Copyright © 2011-2022 走看看