How to Install Sun java jdk installation 1.7 through Chef recipe? I am newbie in this, Can anyone please help me?
Asked
Active
Viewed 9,457 times
-5
-
Welcome to stackoverflow. Usually, you should show that you have at least tried something already and describe what the actual problem is. – StephenKing Oct 02 '15 at 07:07
-
Welcome to SO. I'd recommend following one of the guides, and coming here with questions. There are many great resources out there; maybe start with https://learn.chef.io/ and https://github.com/agileorbit-cookbooks/java#usage – Martin Oct 02 '15 at 11:37
2 Answers
4
There is a cookbook for this, it is called the java cookbook.

StephenKing
- 36,187
- 11
- 83
- 112
-
Sorry...I am using Linux System..I want to install on Linux Machine. I checked the from supermarket.chef.io/cookbooks/java , I downloaded into my Workstation. But , Not sure, How to do changes in recipe, attributes, Can you please help me? – Chetan Patangade Oct 02 '15 at 07:29
-
@ChetanPatangade See: http://stackoverflow.com/questions/28776899/can-the-java-cookbook-be-used-to-install-a-local-copy-of-oracle-java/ – Mark O'Connor Oct 03 '15 at 11:01
1
You should have specified, in which system you want to install JDK - this varies on unix and Windows systems.
First of all, you can use cookbook java
, which can be found here.
Additionaly, if you don't want to use any cookbooks, just install it through Chef resource.
In example, installing JDK on windows (requires windows
cookbook):
windows_package 'Java SE Development Kit 7 Update 79' do
source src
action :install
installer_type :custom
options '/v\"/qn INSTALLDIR=\\\"C:\\Java\\\"\"'
end
This will install JDK 7.79 in C:/Java
directory.
Remember, that name of resource should be the same as package name in system - you can check them in Control Panel (Uninstalling programs).
If you want more informations about installing JDK silently, you can also check this question.
Cheers.
-
Sorry...I am using Linux System..I want to install on Linux Machine. I checked the from https://supermarket.chef.io/cookbooks/java , I downloaded into my Workstation. But , Not sure, How to do changes in recipe, attributes, Can you please help me? – Chetan Patangade Oct 02 '15 at 07:27
-
Ok, first of all, in the link of this cookbook you have examples on the bottom of page. Just do as they say - copy this to your recipe and run chef. I do not know if you are asking me `how to run Chef` or just `how to use this cookbook in my recipe`? – deem Oct 02 '15 at 07:30
-
Thanks.. I have to follow below steps? On My Workstation:- 1.knife cookbook create java 2. In /recipe/default.rb below code # install jdk6 from Oracle java_ark "jdk" do url 'http://download.oracle.com/otn-pub/java/jdk/6u29-b11/jdk-6u29-linux-x64.bin' checksum 'a8603fa62045ce2164b26f7c04859cd548ffe0e33bfc979d9fa73df42e3b3365' app_home '/usr/local/java/default' bin_cmds ["java", "javac"] action :install end 3. Save and exit. 4. Add recipe to node 5. Run Chef-client on Node Is this rite? – Chetan Patangade Oct 02 '15 at 07:38
-
You have to write your own cookbook and add dependency to their cookbook (of course download it and paste it to `cookbooks` directory). Then, in your recipe, just paste their resource (for example `java_ark "jdk" do`, depends on what type of JDK you want to install) and run Chef with your cookbook. You can read their documentation for more usage info - or just search in stackoverflow/Google - this cookbook is rather popular and have many results in searching. – deem Oct 02 '15 at 07:41
-
Yeah, your steps are (more or less) logical, too. But make sure this URL for JDK .exe is valid - if not, you should change it ;) – deem Oct 02 '15 at 07:42