[英]Vagrant provisioning - Puppet install php 5.6
我正在嘗試在Vagrant CentOS 6.5計算機上安裝PHP 5.6,但是已經兩天了,我無法讓Puppet安裝此特定的PHP版本。 我確實進行了搜索,然后用谷歌搜索,但是找不到任何有效的解決方案。 下面是我的實驗,到目前為止
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版本的正確方法?
編輯:換個角度看,看來回購是不正確的。
它使用帶有rpm完整鏈接的鏡像存儲庫,這不是必需的,我無論如何都不是yum
專家,但我查看了我的存儲庫文件,但他們沒有rpm文件的鏈接,因此我更改為uk.repo。 webtatic.com
為了安全起見,請在運行php安裝時對install yum存儲庫提出要求,以便確保它會從其他存儲庫中提取
我的人偶文件看起來像
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
老答案:為什么不使用現有模塊?
就我而言,我使用https://forge.puppetlabs.com/example42/php/readme模塊,它允許您指定php版本:
class { 'php':
version => '5.6.10',
}
它應該工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.