How to Deploying an Apache web server in Chef server

Follow the Steps:

• Go inside the cookbooks folder & create a cookbook

• chef generate cookbook apache-cookbook

• Go inside the cookbook(But not inside the recipes folder)& Create a recipe

• chef generate recipe apache-recipe

• Be inside apache-recipe

package ‘httpd’ do
action :install
end
file ‘/var/www/html/index.html’ do
content ‘Hello Dear Students!!’
action :create
end
service ‘httpd’ do
action [ :enable, :start ]
end

• Apply that recipe locally(be inside cookbooks folder)

• sudo chef-client -zr “recipe[apache-cookbook::apache-recipe]”
• Verify : paste public ip in browser

Leave a Reply

Your email address will not be published.