简体   繁体   English

流浪者置备-Puppet安装PHP 5.6

[英]Vagrant provisioning - Puppet install php 5.6

I am trying to install PHP 5.6 on my Vagrant CentOS 6.5 machine but it has been two days and I can't make Puppet install this specific PHP version. 我正在尝试在Vagrant CentOS 6.5计算机上安装PHP 5.6,但是已经两天了,我无法让Puppet安装此特定的PHP版本。 I did search SO and googled but could not find any solution that worked. 我确实进行了搜索,然后用谷歌搜索,但是找不到任何有效的解决方案。 Here are my experiments so far 下面是我的实验,到目前为止

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'
}

Throughout my experiments I've been getting different error messages when provisioning: 在整个实验过程中,我在配置时得到了不同的错误消息:

==> 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

or 要么

==> 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

I also tried to use example42/php module 我也尝试使用example42 / php模块

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

gives me 给我

==> 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

What is the proper way to install specific php version? 什么是安装特定php版本的正确方法?

EDIT : Giving another look, it seems the repo is not correct. 编辑:换个角度看,看来回购是不正确的。

  1. it uses the mirror repo with rpm full link, this is not necessary, I am not a yum expert in any way but I review my repo file and they dont have the link to rpm file, so I have changed to the uk.repo.webtatic.com 它使用带有rpm完整链接的镜像存储库,这不是必需的,我无论如何都不是yum专家,但我查看了我的存储库文件,但他们没有rpm文件的链接,因此我更改为uk.repo。 webtatic.com

  2. just to be safe, make a require on the install yum repo when running the install of php so you're sure it will pull from the additional repo 为了安全起见,请在运行php安装时对install yum存储库提出要求,以便确保它会从其他存储库中提取

my puppet file looks like 我的人偶文件看起来像

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

and php 5.6.12 get installed in this case: 在这种情况下,将安装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 : why not using an existing module ? 老答案:为什么不使用现有模块?

For my case I use the https://forge.puppetlabs.com/example42/php/readme module, it allows you to specify the php version : 就我而言,我使用https://forge.puppetlabs.com/example42/php/readme模块,它允许您指定php版本:

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

it should work 它应该工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM