Deploying an Apache Web Server in Chef

Share via:

Deploying an Apache Web Server in Chef

In this article,we will see Deploying an Apache Web Server in Chef.

If you want to make server as web server,we need to follow 3 things

  1. Install web package (httpd).
  2. Create file and put some web content.
  3. Start httpd service

we create recipe inside the cookbook and write ruby script belongs to above 3 things then run the recipe.

Once you run the recipe the server became a web server.

Implementation Steps

  1. Connect to Linux EC2 Instance “workstation” through putty.
  2. Switch to root user.
  3. Create a new cookbook “ktexperts-apache-cookbook”.
  4. Create a new recipe “ktexperts-apache-recipe”.
  5. Go to cookbooks directory.
  6. Open the recipe “ktexperts-apache-recipe.rb” and write apache web server script.
  7. Execute the Recipe/call chef-client.
  8. Copy public IP and search in browser.
  9. Modify Recipe “ktexperts-apache-recipe”
  10. Execute the Recipe/call chef-client.
  11. Refresh IPV4 Public IP in browser.

Connect to Linux EC2 Instance “workstation” through putty

Switch to root user

Create a new cookbook “ktexperts-apache-cookbook”

Go inside the cookbooks

create cookbook by using below command

To see the list of files and directories in a tree structure

To see the list of cookbooks

Create a new recipe “ktexperts-apache-recipe”

Go inside the cookbook “ktexperts-apache-cookbook”

using below command to create a new recipe “ktexperts-apache-recipe” inside the cookbook “ktexperts-apache-cookbook”

To see the list of files and directories in a tree structure

 

Go to cookbooks directory

Open the recipe “ktexperts-apache-recipe.rb” and write apache web server script

Note

:wq! — to quit.

Verify syntax of script

Execute the Recipe/call chef-client

Verify content of Apache Web Server

Copy public IP and search in browser

Copy IPV4  Public IP from Chef-Workstation.

 

Search PV4  Public IP in browser

we can able to see the content of apache web server.

Modify Recipe “ktexperts-apache-recipe.rb”

Add some content to the index.html file

Note

:wq! — to quit

Execute the Recipe/call chef-client

Refresh IPV4 Public IP in browser

Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates

KTEXPERTS is always active on below social media platforms.

 

Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...

2 thoughts on “Deploying an Apache Web Server in Chef

Add Comment