To install Apache Tomcat 8 on the node using Chef
- Chef Server
- Chef Work Station
- Node to install and run the Tomcat
- Tomcat cookbook and its dependencies (if any)
- Tomcat and its dependencies can be downloaded from Chef Supermarket
- java >= 0.0.0
- homebrew >= 0.0.0
- windows >= 0.0.0
- apt >= 0.0.0
- ohai >= 4.0.0
- After downloading Tomcat and its dependency Cookbooks from the Chef Supermarket into your local machine, from your Chef DK browse into the chef-repo folder
- Create a new cookbook tomcat8 using the following command “knife cookbook create tomcat8”
- A cookbook will be created in the /cookbooks folder.
- Copy the cookbooks which you have already downloaded (tomcat, java, apt, homebrew, windows and ohai) into /cookbooks folder.
- From your Chef DK, push the cookbook to the Chef Server using the following command “knife cookbook upload tomcat8” and you will encounter will an error that dependencies are missing.
- So, upload the dependencies first and then upload the tomcat8 cookbook.
- To do this, use the below commands to upload the cookbooks one by one in the below format
- knife cookbook upload homebrew
- knife cookbook upload ohai
- knife cookbook upload windows
- knife cookbook upload apt
- knife cookbook upload java
- Then finally, knife cookbook upload tomcat
- All the cookbooks can be uploaded in one go using the following command “knife cookbook upload -a”
- After all the cookbooks are uploaded into the Chef server, check the cookbooks in the Chef GUI.
- Now add the tomcat cookbook to the node’s run list using the following command “knife node run_list add node_name “recipe[tomcat8]””
- Even we can add the run list from the Chef GUI by going to the node’s tab, direct to the Edit Run List on the left-hand side.
- Drag in the tomcat recipe in the Available Recipe to Current Run List.
- After adding the run list to a following node, connect to the node using Putty.
- After getting logged in, use the command to install and run the tomcat8 cookbook using “sudo chef-client”
- And that’s it you can see the tomcat8 is being installed on the assigned node.
- To check tomcat is up and running use the following code “service tomcat8 status” from your node machine.
- To access from the web browser, use your node IP address follow by 8080 (port) which looks like http://xxx.xxx.xxx.xxx:8080/
- An Apache Tomcat home page is displayed if Tomcat is successfully installed.
we have successfully tomcat using chef