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. 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
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?
EDIT : Giving another look, it seems the repo is not correct.
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
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
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:
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 :
class { 'php':
version => '5.6.10',
}
it should work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.