2016-05-23 42 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中更全面的處理示例。