流浪汉配置 - Puppet安装php 5.6

时间:2015-08-26 15:55:36

标签: vagrant puppet

我正在尝试在我的Vagrant CentOS 6.5计算机上安装PHP 5.6但是已经有两天了,我不能让Puppet安装这个特定的PHP版本。我搜索过SO并用谷歌搜索但找不到任何有效的解决方案。这是我到目前为止的实验

yumrepo {
         "webtatic":
            descr          => "webtatic",
        baseurl            => "https://mirror.webtatic.com/yum/el6/webtatic-release.rpm",
            failovermethod => "priority",
            gpgcheck       => "0",
            enabled        => "1";
          } 



yumrepo {
         "webtatic":
            descr          => "epel-release",
        baseurl            => "https://mirror.webtatic.com/yum/el6/epel-release.rpm",
            failovermethod => "priority",
            gpgcheck       => "0",
            enabled        => "1";
          } 



package { 'php56w' :
  ensure => 'present'
}

在我的实验中,我在配置时收到了不同的错误消息:

==> default: Error: /Stage[main]/Main/Package[php56w]/ensure: change from absent to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install php56w' returned 1: Error: Nothing to do

==> default: Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install php56w' returned 1: Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel-release. Please verify its path and try again

我还尝试使用example42/php模块

class { 'php':
  version => '5.6.10',
}

给了我

==> default: Error: /Stage[main]/Php/Package[php]/ensure: change from absent to 5.6.10 failed: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install php-5.6.10' returned 1: Error: Nothing to do
==> default:
==> default: Notice: /Stage[main]/Php/File[php.conf]: Dependency Package[php] has failures: true

安装特定php版本的正确方法是什么?

1 个答案:

答案 0 :(得分:1)

编辑:再看一下,看起来回购不正确。

  1. 它使用带有rpm完整链接的镜像仓库,这不是必需的,我不是任何方式的yum专家,但我查看我的repo文件,他们没有rpm文件的链接,所以我已经改为 uk.repo.webtatic.com

  2. 为了安全起见,在运行安装php时在安装yum repo上提出要求,这样你就可以确定它会从额外的仓库中提取

  3. 我的木偶文件看起来像

    class repo {
      yumrepo { "webtatic":
        descr          => "epel-release",
        baseurl        => "https://uk.repo.webtatic.com/yum/el6/$architecture",
        failovermethod => "priority",
        gpgcheck       => "0",
        enabled        => "1";
      } 
    }
    
    class php {
      package { "php56w": 
        ensure  => installed, 
        require => Yumrepo["webtatic"] }
    }
    
    include repo
    include php
    
    在这种情况下

    和php 5.6.12安装:

    fhenri@machine:/Volumes/WORK/project/phpbox$ vagrant ssh
    Last login: Thu Aug 27 08:18:26 2015 from 172.16.42.1
    Welcome to your Packer-built virtual machine.
    [ariba@localhost ~]$ php -version
    PHP 5.6.12 (cli) (built: Aug  9 2015 11:16:17)
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    

    OLD ANSWER:为什么不使用现有模块?

    对于我的情况,我使用https://forge.puppetlabs.com/example42/php/readme模块,它允许您指定php版本:

    class { 'php':
      version => '5.6.10',
    }
    

    它应该有用