【问题标题】:Install Specific PHP Version with Puppet & Vagrant使用 Puppet 和 Vagrant 安装特定的 PHP 版本
【发布时间】:2014-07-19 06:38:00
【问题描述】:

第一次使用 puppet 用户,我无法使用 Vagrant 安装指定版本的 PHP。我正在使用 example42/php 模块,但我一直遇到ensure 问题。

Error: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install php-5.5.12' returned 1: Error: Nothing to do
Error: /Stage[main]/Php/Package[php]/ensure: change from absent to 5.5.12 failed: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install php-5.5.12' returned 1: Error: Nothing to do
Warning: /Stage[main]/Php/File[php.conf]: Skipping because of failed dependencies

从我的控制台中吐出,然后是另一个相同的尝试。

我正在配置的 .pp 文件:

class lamp {
    # package {'php':
    #   ensure => present,
    # }
}
node 'node1' {  
    include lamp
    file { '/php':
        ensure => directory,
        # I read that I may need to have a directory in order for the install to work...
    }
    class { 'php':
        version => '5.5.12',
    }
}

据我所知,我正确引用了存储在 /puppet/modules/ 中的模块,并且它正在找到它们,但是我很难安装特定版本的 PHP。我可以为 Puppet 使用一个非常简单的“入门 LAMP”但即使我 ensure => latest,

也只能安装 5.3.3

【问题讨论】:

    标签: php vagrant puppet


    【解决方案1】:

    puppet 模块只使用您系统的包管理器 (yum) 来下载特定的 php 包。如果它找不到所需的包,它将无法工作。 5.3.3 是您存储库中的最新版本,因此安装它。如果这是您的存储库中唯一可用的 php 版本,我不会感到惊讶。

    您需要使用一些包含所需 PHP 包的存储库来配置 yum,然后尝试使用 puppet 模块。

    【讨论】:

    • 我想是有道理的。我特别读到我不应该使用 puppet 进行 yum 更新,因为这违背了特定版本安装的目的。这是真的?如何在 puppet 中指定将 yum 的 PHP 存储库更新为更当前或更具体的内容?
    • 不用担心 yum 更新。您可以使用 package { 'foo_package': ensure => latest } 之类的内容将特定软件包更新到最新版本,以更新 repo。看看 yumrepo 类型:docs.puppetlabs.com/references/latest/type.html#yumrepo.
    • ensure => latest 仍然会在这个例子中安装 5.3.3,但是。
    • 我已经成功触发了 yum 更新,但是我仍然缺少一些东西来让 yum 识别 PHP 的 5.4 或 5.5(或任何其他版本)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-20
    • 1970-01-01
    • 2012-02-12
    • 2012-07-21
    • 1970-01-01
    • 1970-01-01
    • 2014-03-02
    相关资源
    最近更新 更多