2016-05-23 39 views
1

我是新来的厨师,我正在尝试编写一个厨师食谱,将从软件收集安装PHP 5.6。如何启用软件收集软件

的安装步骤如下:

// Step:1 
sudo yum install centos-release-scl //id Centos 
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms //if RHEL 
// Step:2 
sudo yum install rh-php56 
// Step: 3 
scl enable rh-php56 bash 

我做了什么至今:

case node['platform'] 
when 'centos' 
    yum_package 'centos-release-scl' 
when 'rhel' 
    bash 'enable RHSCL' do 
    code 'sudo yum-config-manager --enable rhel-server-rhscl-7-rpms' 
    end 
end 

package 'rh-php56' 

execute 'software-collection' do 
    command 'scl enable rh-php56 bash' 
end 

我不知道为什么使rh-php56最后一部分是行不通的。 我试过用bash资源,但仍然没有结果。

干杯。

回答

1

scl enable仅针对您在那里给出的特定命令(示例中为bash)启用收集。这不是一个全球性的设置。您必须在scl enable前面加上每个PHP命令的前缀。我没有PHP的烹饪书,但请查看poise-ruby和poise-python如何处理SCL以获得Chef中更全面的处理示例。