一、软件需求

  1. Windows 7 旗舰版 sp1 X64

  2. ActivePerl-5.22.3.2204-MSWin32-x64-401627.exe

  3. diffutils-2.8.7-1.exe, 编译之后回归测试使用,需要手工添加bin路径到PATH

  4. visual studio ultimate 2013,VS2013_RTM_ULT_CHS.iso

  5. visual assist,代码格式化工具

  6. postgresql-9.6.2.tar.gz,pg源码

二、安装IDE工具

1.安装Perl

下载ActivePerl-5.22.3.2204-MSWin32-x64-401627.exe,双击安装

单击"next",选择"接受协议",

单击"next",安装类型"Type",

安装选项"Add Perl to the PATH environment variable","create Perl file extension association"

单击"next",单击"install",单击"finish"

添加 bin目录"C:\Perl64\bin",配置到系统环境变量PATH.

2.安装Windows 平台 diff工具,回归测试使用

下载diffutils-2.8.7-1.exe安装包,双击安装

单击"next",选择"接受协议",默认配置,单击"next",...,单击"install",单击"finish"

把软件安装的bin目录"C:\Program Files (x86)\GnuWin32\bin",配置到系统环境变量PATH中.

3.安装visual studio ultimate 2013

下载VS2013_RTM_ULT_CHS.iso,并解压到VS2013_RTM_ULT_CHS目录,解压完成进入这个目录

双击"vs_ultimate.exe"进行安装,提示IE 8 不兼容建议IE 10 ,单击"继续",

选择"同意许可",单击"下一步"

选择安装功能,只选择"用于C++的Microsoft基础类",单击"安装"

安装成功后,单击"启动",程序界面加载完成,帮助->注册产品,输入产品序列号

4.安装visual assist

双击"VA_X_Setup2001.exe",只选择"Microsoft visual studio 2013 RC",单击"install"

单击"确定",安装成功

5.获取postgresql源码

解压postgresql-9.6.2.tar.gz到F 盘根目录

6. 编译安装数据库

开始->所有程序->visual studio 2013->visual studio tools

目录中双击"VS2013 x64 本机工具命令提示",打开visual studio 2013命令行窗口

转到"F:\postgresql-9.6.2\src\tools\msvc"目录,

1) 编译数据库

执行perl build.pl DEBUG(DEBUG,代表调试模式,如果不加表示非调试模式)

2) 回归测试,

perl vcregress.pl check

.............

test event_trigger            ... ok

test stats                    ... ok

============== shutting down postmaster               ==============

============== removing temporary instance            ==============

=======================

All 167 tests passed.

=======================

3) 安装数据库

F:\postgresql-9.6.2\src\tools\msvc>perl install.pl f:\pg962

Installing version 9.6 for debug in f:\pg962

Copying build output files......................................................

..........................................................................

Copying config files......

Copying Import libraries...

Copying contrib data files......................................................

................................................................................

...........................................................................

Copying Public headers......

Copying Libpq headers..

Copying Libpq internal headers..

Copying Internal headers...

Copying Server headers....

Copying Grammar header.

......................

Copying PL/pgSQL header.

复制了 63 个文件

复制了 1 个文件

复制了 78 个文件

复制了 33 个文件

复制了 9 个文件

复制了 1 个文件

复制了 48 个文件

复制了 6 个文件

复制了 2 个文件

复制了 7 个文件

复制了 13 个文件

复制了 1 个文件

复制了 19 个文件

复制了 25 个文件

复制了 21 个文件

复制了 41 个文件

复制了 2 个文件

复制了 10 个文件

复制了 5 个文件

复制了 14 个文件

复制了 7 个文件

复制了 34 个文件

复制了 50 个文件

复制了 6 个文件

复制了 7 个文件

复制了 77 个文件

Copying ECPG headers...............

Copying ECPG informix headers...

Copying timezone names..........

Copying timezone sets...

Copying BKI files...

Copying SQL files..

Copying Information schema data.

Generating conversion proc script...

Generating timezone files...

Generating tsearch script..................

Copying Stopword files..............

Copying Dictionaries sample files.........

Copying PL Extension files...

Installation complete.

F:\postgresql-9.6.2\src\tools\msvc>

4) 初始化数据库

F:\postgresql-9.6.2\src\tools\msvc>cd /d f:\pg962\bin

f:\pg962\bin>initdb.exe -D ../data

The files belonging to this database system will be owned by user "Administrator

".

This user must also own the server process.

The database cluster will be initialized with locale "Chinese (Simplified)_Peopl

e's Republic of China.936".

Encoding "GBK" implied by locale is not allowed as a server-side encoding.

The default database encoding will be set to "UTF8" instead.

initdb: could not find suitable text search configuration for locale "Chinese (S

implified)_People's Republic of China.936"

The default text search configuration will be set to "simple".

Data page checksums are disabled.

creating directory ../data ... ok

creating subdirectories ... ok

selecting default max_connections ... 100

selecting default shared_buffers ... 128MB

selecting dynamic shared memory implementation ... windows

creating configuration files ... ok

running bootstrap script ... ok

performing post-bootstrap initialization ... ok

syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections

You can change this by editing pg_hba.conf or using the option -A, or

--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

"pg_ctl" -D "../data" -l logfile start

f:\pg962\bin>

5) 启动数据库

f:\pg962\bin>pg_ctl.exe -D "../data" -l logfile start

server starting

pg数据库已经编译安装并运行起来了,可以正常使用.

执行select version();查看下版本

f:\pg962\bin>psql postgres

psql (9.6.2)

Type "help" for help.

postgres=# \du

List of roles

Role name   |                         Attributes                         | Me

mber of

---------------+------------------------------------------------------------+---

--------

Administrator | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

postgres=# select version();

version

-------------------------------------------------------------

PostgreSQL 9.6.2, compiled by Visual C++ build 1800, 64-bit

(1 row)

postgres=#

问题解答:

装上后再跑执行 perl build.pl报如下错误: Unable to determine Visual Studio version: The nmake version could not be determined. at src/tools/msvc/Mkvcbuild.pm line 86.  这是perl脚本中不能正常识别vs版本造成,该问题历史悠久,不知道pg为什么不修复,要修正很简单,打开msvc目录中 VSObjectFactory.pm文件,把该文件最下面的 DetermineVisualStudioVersion 函数中  if ($output =~ /(\d+)\.(\d+)\.\d+(\.\d+)?$/m) 这行改成if ($output =~ /(\d+)\.(\d+)\.\d+(\.\d+).*$/m)  ,实际就是将 ? 改成.* 即可。

本文转自 pgmia 51CTO博客,原文链接:http://blog.51cto.com/heyiyi/1904583

postgresql windows 开发环境搭建相关推荐

  1. ODOO13 开发教程二 Windows开发环境搭建

    这篇文章写给刚接触odoo开发的朋友,在这篇文章中,主要介绍Windows下,odoo开发环境的搭建方法. 本文的推荐开发环境搭建使用 PyCharm.Python3.7.odoo13社区版 Wind ...

  2. 2.2 Trino Windows开发环境搭建—源码修改篇

    1. 前言 在上一篇中,介绍了在Windows上搭建Trino开发环境所需要的组件.本篇文章,主要介绍通过修改源码,让Trino在Idea中运行起来. 2. 步骤 1)配置文件 Trino的配置文件位 ...

  3. .NET6入门:1.Windows开发环境搭建

    作为.NET的最新版本.NET6长期支持版已经发布,.NET6宣称是迄今为止最快的.NET.那当然不能落下时代的潮流,就让我们跟着文章进入.NET6的世界吧. 1. .NET6SDK下载 Downlo ...

  4. nRF Connect SDK(NCS)-Windows开发环境搭建

    目录 安装nRF Connet for Desktop 安装nRF Command Line Tools 安装nRF Connect SDK 1.打开nRF Connet for Desktop,安装 ...

  5. react-native for android windows开发环境搭建详细记录

    先说说整个环境搭建的过程.上周开始要在windows上搭建react-native for android环境,当时按照找的教程,从git上clone master分支的代码,然后下载了node,安装 ...

  6. ESP32 ADF windows开发环境搭建 适配ADF到ESP32A1S

    搭建ESP32A1S的ADF开发环境 文章目录 搭建ESP32A1S的ADF开发环境 一,获取IDF和IDF-TOOL 二,安装ADF 三,适配ADF到ESP32A1S 四,使用asr语音识别例程 一 ...

  7. ESP32 ESP-IDF CMake Windows开发环境搭建

    简介 ESP-IDF 是 ESP32 芯片的官方开发框架 GUN Make和CMake的对比 GUN Make在Linux和Mac OS很容易构建一个工程,但Windows使用GUN需要使用MinGW ...

  8. redmine二次开发实战--windows开发环境搭建

    目录 目录 前言 一.安装redmine 1.下载安装包 2.安装程序 二.开发工具 总结 目录 前言 redmine是基于ruby on rails架构的一款项目管理软件,虽然ruby在window ...

  9. ffmpeg教程java_ffmpeg Windows开发环境搭建

    一.在windows上搭建基于ffmpeg解决方案的开发环境 系统 : Windows 10 x86_64系统  i5 4核cpu 8gb内存 工具: Visual Studio Community ...

最新文章

  1. 神经网络“炼丹炉”内部构造长啥样?牛津大学博士小姐姐用论文解读
  2. php参数一个字符串数组,PHP字符串控制台参数到数组
  3. vbs获取cpu使用率
  4. ansi c标准_C/C++的起源与发展故事,我是最牛的软件编程语言,不接受反驳
  5. 将对象集合包装成JSON格式
  6. 【深搜】骑士游历(二)
  7. 10年老电脑如何提速_2020年10月和双十一轻薄本/轻薄型笔记本电脑如何挑选?内含轻薄本/轻薄型笔记本电脑推荐!...
  8. Sqlite - constraint failed[0x1555]: UNIQUE constraint failed
  9. linux 命令 — cut
  10. 桥牌笔记:机会最多的打法
  11. 带有H5标签的字符串
  12. java引入math包_java.math包应用
  13. 04/31Day 孤尽训练营笔记分享
  14. 【Matlab学习手记】Matlab积分问题
  15. 爱签电子合同怎么签,应该注意哪些问题?
  16. 阿里云 ECS 构建集群
  17. excel智能提取_Excel智能艺术家谱
  18. Apache配置与应用
  19. 【机器学习】懒惰学习
  20. Java网站安全笔记

热门文章

  1. Jquery-zTree的基本用法
  2. JavaScript typeof() 这个函数是干什么用的?有几个参数,每个参数代表什么?
  3. matlab中如何求零极点,Matlab中绘制零极点
  4. java 对象怎么序列化,java对象序列化总结
  5. python做数据分析的包_用Python做数据分析,Numpy,Pandas,matp
  6. 智能车竞赛技术报告 | 专科基础组 - 哈尔滨铁道职业技术学院 - 智能车勇创协会
  7. TPS54360 输入60V,输出3.5A降压开关电压
  8. 从课堂走向实践还有多远?
  9. 微型计算机一般按字长进行分类,关于计算机中:字,字节,字长,位的关系
  10. linux ubuntu无法登陆,新手入门求解答!ubuntu命令创建用户无法登入问题!