【问题标题】:Vagrant with Chef - Errors when provisioning VMVagrant with Chef - 配置 VM 时出错
【发布时间】:2014-03-16 06:43:34
【问题描述】:

我很难用 Vagrant 设置虚拟机。

每当我使用 vagrant>provision 时,Chef 都会失败:

[2014-03-15T19:16:08+00:00] 错误:chef_gem[pg](postgresql::ruby 第 39 行)有一个错误:Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem本机扩展。

> /opt/chef/embedded/bin/ruby extconf.rb checking for pg_config... yes
> Using config values from /usr/bin/pg_config checking for libpq-fe.h... yes
> checking for libpq/libpq-fs.h... yes 
> checking for pg_config_manual.h... yes checking for PQconnectdb() in -lpq... no
> checking for PQconnectdb() in -llibpq... no 
> checking for PQconnectdb() in -lms/libpq... no 
> Can't find the PostgreSQL client library (libpq)
> *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.  Check
> the mkmf.log file for more details.  You may need configuration
> options.

我很难理解在这里做什么。我已经在虚拟机上手动安装了 postgres,从 cheffile 中删除了 postgres,但 Chef 仍然失败。

任何帮助表示赞赏。

【问题讨论】:

    标签: ruby postgresql chef-infra vagrant


    【解决方案1】:

    您需要包含 postgresql::ruby 配方才能安装扩展。

    【讨论】:

      【解决方案2】:

      您需要在 VM 上为 pg gem 安装 postgres 客户端库

      【讨论】: