设为首页 收藏本站
查看: 744|回复: 0

[经验分享] postgresql windows 开发环境搭建

[复制链接]

尚未签到

发表于 2018-6-19 07:20:48 | 显示全部楼层 |阅读模式
  一、软件需求

  •   Windows 7 旗舰版 sp1 X64
  •   ActivePerl-5.22.3.2204-MSWin32-x64-401627.exe
  •   diffutils-2.8.7-1.exe, 编译之后回归测试使用,需要手工添加bin路径到PATH
  •   visual studio ultimate 2013,VS2013_RTM_ULT_CHS.iso
  •   visual assist,代码格式化工具
  •   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)  ,实际就是将 ? 改成.* 即可。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-525624-1-1.html 上篇帖子: redis和mongo配置为windows服务 下篇帖子: wce配合彩虹表破解windows的用户HASH-Well begun is half done.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表