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;

  • 相关阅读:
    luoguP5024 保卫王国 动态dp
    luoguP4571 [JSOI2009]瓶子和燃料 裴蜀定理
    luoguP3235 [HNOI2014]江南乐 数论分块 + 博弈论
    luoguP4101 [HEOI2014]人人尽说江南好 结论
    hdu 3032 NIm or not Nim? Multi SG
    luoguP4279 [SHOI2008]小约翰的游戏 Anti-SG 博弈论
    luoguP3480 [POI2009]KAM-Pebbles 阶梯Nim
    Educational Codeforces Round 65 (Div. 2)
    [PKUSC2018]主斗地(搜索+贪心)
    Codeforces Round #557 (Div. 1)
  • 原文地址:https://www.cnblogs.com/EikiXu/p/11056707.html
Copyright © 2011-2022 走看看