简体   繁体   中英

Trying to install apache on CentOS7 using Chef

I'm trying to use Chef on CentOS7 and I'm at the beginning ... following the tutorial I0m trying to install apache using this recipe.

package 'apache2' do
 action :install
end

service 'apache2' do
 action [:enable, :start]
end

file '/var/www/index.html' do
 content '<html>
           <body>
            <h1>Hello world!!</h1>
           </body>
          </html>'
end

When I try to execute I obtain this error ...

[osboxes@osboxes chef-repo]$ sudo chef-apply hello.rb 
Recipe: (chef-apply cookbook)::(chef-apply recipe)
  * yum_package[apache2] action install
    * No candidate version available for apache2
    ================================================================================
    Error executing action `install` on resource 'yum_package[apache2]'
    ================================================================================

    Chef::Exceptions::Package
    -------------------------
    No candidate version available for apache2

The same if I use a simpler recipe like this

package 'apache2' 

My Chef client workstation installation is the following

[osboxes@osboxes chef-repo]$ chef --version
Chef Development Kit Version: 3.0.36
chef-client version: 14.1.12
delivery version: master (7206afaf4cf29a17d2144bb39c55b7212cfafcc7)
berks version: 7.0.2
kitchen version: 1.21.2
inspec version: 2.1.72

On CentOS / RHEL etc (and on Fedora) the package name for Apache is "httpd".

Alternatively, there is a standard cookbook for installing and configuring Apache2:

It is fairly sophisticated, and includes recipes for configuring a number of common Apache modules.

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.

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