zoukankan      html  css  js  c++  java
  • PostgreSql和PostGIS安装——Windows10家庭版

    PostgreSql和PostGIS安装——Windows10家庭版


    一、安装环境

    1、系统环境:Windows 10 家庭中文版

    2、PostgreSql:postgresql-11.2-1-windows-x64

    3、PostGIS:postgis-bundle-pg11x64-setup-3.1.0-1.exe


    二、下载地址

    PostgreSql:https://get.enterprisedb.com/postgresql/postgresql-11.2-1-windows-x64.exe

    PostGIS:可以直接通过安装postgreSql时下载,其它下载渠道:http://download.osgeo.org/postgis/windows/pg11/


    三、安装异常

    本来想安装:postgresql-12.5-1-windows-x64,但是安装报以下错误,所以选择了11.2.1版本。

    2391205016

    四、PostgreSQL安装过程和postgis下载

    4266332567

    2670085252

    我修改了安装路径:D:oyz3dserverPostgreSQL11

    535001796

    第1个筛选框:安装PostgreSql服务。

    第2个筛选框:安装paAdmin客户端,用于连接操作postgreSql数据库。

    第3个筛选框:安装结束后,可以打开新窗口,安装postgresql相关的其它插件,比如:PostGIS.

    第4个筛选框:必选,未知。

    1717940573

    2640365190

    设置数据库密码:123456

    1867650805

    设置数据库端口号:5432

    460165893


    3287968946[3]

    3804146325[3]

    3224297739

    914721187

    到至postgresql安装完成。以下是下载PostGis,但是下载很慢,建议下载地址:http://download.osgeo.org/postgis/windows/pg11/

    2894101264

    1154930136

    选择PostGIS的版本(3个任选其一)和下载位置。

    2852209832

    五、PostGIS安装

    905839239

    1503907567

    2243371936

    1847757257

    1182535459

    1889344173

    2191509857

    63787884

    2667151099

    1447081462

    1810052550

    六、其它操作

    1、在命令行输入:services.msc 打开服务,可以看到postgresql数据默认已设置为开机启动

    126783930

    2、加入全局环境变量

    2693785838

    3、测试PostGIS是否安装成功

    Microsoft Windows [版本 10.0.18363.1316]
    (c) 2019 Microsoft Corporation。保留所有权利。
    
    
    #######连接登录postgresql数据库
    C:Userszhao>psql -U postgres -h localhost -d postgres -p 5432
    用户 postgres 的口令:
    psql (11.2)
    输入 "help" 来获取帮助信息.
    
    #######创建test数据库
    postgres=# create database test;
    CREATE DATABASE
    
    #######切换test数据库
    postgres=# c test;
    您现在已经连接到数据库 "test",用户 "postgres".
    
    #######创建postgis扩展
    test=# create extension postgis;
    CREATE EXTENSION
    
    #######查询全部扩展
    test=# select postgis_full_version();
                                                                          postgis_full_version                              
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------
     POSTGIS="3.1.0 3.1.0" [EXTENSION] PGSQL="110" GEOS="3.9.0-CAPI-1.14.1" PROJ="7.1.1" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)"
    (1 行记录)
    
    
    test=#

    七、配置数据库远程访问

    PG默认只能本机访问,但是实际情况中,应用服务器多单独部署,需要开通PG的远程访问权限,且是需要配置用户密码的。

    需要修改postgres.conf, pg_hba.conf文件。

    文件位置:

    D:oyz3dserverPostgreSQL11datapostgresql.conf
    D:oyz3dserverPostgreSQL11datapg_hba.conf
    修改postgresql.conf
    #listen_addresses='localhost'
    listen_addresses='*'   --- 修改成'*'全部ip都可以访问改数据库。
    修改pg_hba.conf
    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    
    # IPv4 local connections:
    host    all             all             127.0.0.1/32            md5
    # IPv6 local connections:
    host    all             all             ::1/128                 md5
    # Allow replication connections from localhost, by a user with the
    # replication privilege.
    host    replication     all             127.0.0.1/32            md5
    host    replication     all             ::1/128                 md5
    host    all             all             0.0.0.0/0               md5   --添加本行数据

    注意: 重启pg数据库


    八、PostgreSql与PostGIS卸载

    1206602245

  • 相关阅读:
    Android商城开发系列(六)——使用 OkHttpUtils 请求网络 + 使用 fastjson解析数据
    Android商城开发系列(五)—— 商城首页回到顶部和搜索框布局实现
    Android商城开发系列(一)——开篇
    Android商城开发系列(四)——butterknife的使用
    Android商城开发系列(三)——使用Fragment+RadioButton实现商城底部导航栏
    Android商城开发系列(二)——App启动欢迎页面制作
    使用git克隆指定分支的代码
    mongodb 3.x WiredTiger存储优化测试
    oracle 文件导出
    本地安装gem install --local redis-stat-0.4.13.gem
  • 原文地址:https://www.cnblogs.com/haolb123/p/14330532.html
Copyright © 2011-2022 走看看