Windows Server 2012 R2 上安装PostgreSQL 13

第一步 安装Windows Server 2012 升级补丁

按照顺序安装

  • Windows8.1-KB2939087-x64.msu
  • Windows8.1-KB2975061-x64.msu
  • Windows8.1-KB2919355-x64.msu
  • Windows8.1-KB2999226-x64.msu

第二步 安装MicroSoft VC++ 2015-2019 Redistributable 环境

  • 下载并安装VC_redist.x64.exe 下载地址 https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
  • 按操作系统版本选择下载


    选择版本

    第三步 安装postgresql-13.2-1-windows-x64

    第四步 在服务器上创建非管理员账号(注意命令行用管理员身份)

    执行命令 net user postgres password /add 创建postgres账号
    执行命令 runas /user:postgres cmd.exe 以postgres账号运行cmd窗口

    第五步 以管理员账号注册postgres服务


    initdb.exe -D "D:\Program Files\PostgreSQL\13\data" -E UTF-8 --locale=chs -U postgres -W

    第六步 初始化数据库及服务启动

    以系统管理员运行命令 initdb.exe -D "D:/PostgreSQL/13/data" -E UTF-8 --locale=chs -U postgres -W


    初始化数据

    设置系统环境变量PGDATA


    系统环境变量

    以系统管理员运行命令运行 pg_ctl.exe start 启动服务


    启动服务

    第七步 允许远程访问postgresql

    • 找到postgresql.conf文件,注意安装路径
      D:\Program Files (x86)\PostgreSQL\9.3\data
    • 打开该文件,注意以下内容,确认为下面内容后,进行下一步
      listen_addresses = '*'
    • 打开pg_hba.conf文件,注意以下内容
      host all all 0.0.0.0/32 trust
    • 在Windows的服务中重新启动postgre服务

     

    posted on   zyp_java_net  阅读(1390)  评论(0编辑  收藏  举报

    编辑推荐:
    · Linux系列:如何用 C#调用 C方法造成内存泄露
    · AI与.NET技术实操系列(二):开始使用ML.NET
    · 记一次.NET内存居高不下排查解决与启示
    · 探究高空视频全景AR技术的实现原理
    · 理解Rust引用及其生命周期标识(上)
    阅读排行:
    · DeepSeek 开源周回顾「GitHub 热点速览」
    · 物流快递公司核心技术能力-地址解析分单基础技术分享
    · .NET 10首个预览版发布:重大改进与新特性概览!
    · AI与.NET技术实操系列(二):开始使用ML.NET
    · 单线程的Redis速度为什么快?

    导航

    < 2025年3月 >
    23 24 25 26 27 28 1
    2 3 4 5 6 7 8
    9 10 11 12 13 14 15
    16 17 18 19 20 21 22
    23 24 25 26 27 28 29
    30 31 1 2 3 4 5
    点击右上角即可分享
    微信分享提示