Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Development repository for Opscode Cookbook java

License

NotificationsYou must be signed in to change notification settings

petegallagher/java

 
 

Repository files navigation

This cookbook installs a Java JDK/JRE. It defaults to installingOpenJDK, but it can also install Oracle and IBM JDKs.

IMPORTANT NOTE

As of 26 March 2012 you can no longer directly download the JDK fromOracle's website without using a special cookie. This cookbook usesthat cookie to download the oracle recipe on your behalf, however thejava::oracle recipe forces you to set either override thenode['java']['oracle']['accept_oracle_download_terms'] to true orset up a private repository accessible by HTTP.

Example

override theaccept_oracle_download_terms in, e.g.,roles/base.rb

default_attributes(  :java => {     :oracle => {       "accept_oracle_download_terms" => true     }   })

Requirements

Chef 0.10.10+ and Ohai 6.10+ forplatform_family use.

Platform

  • Debian, Ubuntu
  • CentOS, Red Hat, Fedora, Scientific, Amazon, XenServer
  • ArchLinux
  • FreeBSD
  • Windows

This cookbook includes cross-platform testing support viatest-kitchen, seeTESTING.md.

Attributes

Seeattributes/default.rb for default values.

  • node['java']['remove_deprecated_packages'] - Removes the nowdeprecated Ubuntu JDK packages from the system, defaultfalse
  • node['java']['install_flavor'] - Flavor of JVM you would likeinstalled (oracle,openjdk,ibm,windows), defaultopenjdkon Linux/Unix platforms,windows on Windows platforms.
  • node['java']['jdk_version'] - JDK version to install, defaults to'6'.
  • node['java']['java_home'] - Default location of the"$JAVA_HOME".
  • node['java']['openjdk_packages'] - Array of OpenJDK package namesto install in thejava::openjdk recipe. This is set based on theplatform.
  • node['java']['tarball'] - Name of the tarball to retrieve fromyour internal repository, defaultjdk1.6.0_29_i386.tar.gz
  • node['java']['tarball_checksum'] - Checksum for the tarball, ifyou use a different tarball, you also need to create a new sha256checksum
  • node['java']['jdk'] - Version and architecture specific attributesfor setting the URL on Oracle's site for the JDK, and the checksum ofthe .tar.gz.
  • node['java']['oracle']['accept_oracle_download_terms'] - Indicatesthat you accept Oracle's EULA
  • node['java']['windows']['url'] - The internal location of yourjava install for windows
  • node['java']['windows']['package_name'] - The package name used bywindows_package to check in the registry to determine if the installhas already been run
  • node['java']['ibm']['url'] - The URL which to download the IBMJDK/SDK. See theibm recipe section below.
  • node['java']['ibm']['accept_ibm_download_terms'] - Indicates thatyou accept IBM's EULA (forjava::ibm)

Recipes

default

Include the default recipe in a run list, to getjava. By defaulttheopenjdk flavor of Java is installed, but this can be changed byusing theinstall_flavor attribute. By default on Windows platformsystems, theinstall_flavor iswindows.

OpenJDK is the default because of licensing changes made upstream byOracle. See notes on theoracle recipe below.

openjdk

This recipe installs theopenjdk flavor of Java. It also uses thealternatives system on RHEL/Debian families to set the default Java.

oracle

This recipe installs theoracle flavor of Java. This recipe does notuse distribution packages as Oracle changed the licensing terms withJDK 1.6u27 and prohibited the practice for both RHEL and Debian familyplatforms.

For both RHEL and Debian families, this recipe pulls the binarydistribution from the Oracle website, and installs it in the defaultJAVA_HOME for each distribution. For Debian, this is/usr/lib/jvm/default-java. For RHEl, this is/usr/lib/jvm/java.

After putting the binaries in place, thejava::oracle recipe updates/usr/bin/java to point to the installed JDK using theupdate-alternatives script. This is all handled in thejava_arkLWRP.

oracle_i386

This recipe installs the 32-bit Java virtual machine without settingit as the default. This can be useful if you have applications on thesame machine that require different versions of the JVM.

This recipe operates in a similar manner tojava::oracle.

windows

Because there is no easy way to pull the java msi off oracle's site,this recipe requires you to host it internally on your own http repo.

ibm

Thejava::ibm recipe is used to install the IBM version of Java.Note that IBM requires you to create an accountand log in todownload the binary installer for your platform. You must accept thelicense agreement with IBM to use their version of Java. In thiscookbook, you indicate this by settingnode['java']['ibm']['accept_ibm_download_terms'] totrue. You mustalso host the binary on your own HTTP server to have an automatedinstallation. Thenode['java']['ibm']['url'] attribute must be setto a valid https/http URL; the URL is checked for validity in the recipe.

At this time thejava::ibm recipe does not support multiple SDKinstallations.

Resources/Providers

This cookbook contains thejava_ark LWRP. Generally speaking thisLWRP is deprecated in favor ofark from theark cookbook, but it isstill used in this cookbook for handling the Oracle JDK installation.

By default, the extracted directory is extracted toapp_root/extracted_dir_name and symlinked toapp_root/default

Actions

  • :install: extracts the tarball and makes necessary symlinks
  • :remove: removes the tarball and run update-alternatives for allsymlinkedbin_cmds

Attribute Parameters

  • url: path to tarball, .tar.gz, .bin (oracle-specific), and .zipcurrently supported
  • checksum: SHA256 checksum, not used for security but avoidredownloading the archive on each chef-client run
  • app_home: the default for installations of this type ofapplication, for example,/usr/lib/tomcat/default. If yourapplication is not set to the default, it will be placed at the samelevel in the directory hierarchy but the directory name will beapp_root/extracted_directory_name + "_alt"
  • app_home_mode: file mode for app_home, is an integer
  • bin_cmds: array of binary commands that should be symlinked to/usr/bin, examples are mvn, java, javac, etc. These cmds must be inthebin subdirectory of the extracted folder. Will be ignored if thisjava_ark is not the default
  • owner: owner of extracted directory, set to "root" by default
  • default: whether this the default installation of this package,boolean true or false

Examples

# install jdk6 from Oraclejava_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 :installend

Usage

Simply include thejava recipe where ever you would like Java installed.

To install Oracle flavored Java override thenode['java']['install_flavor'] attribute with in role:

name "java"description "Install Oracle Java on Ubuntu"default_attributes(  "java" => {    "install_flavor" => "oracle"  })run_list(  "recipe[java]")

To install IBM flavored Java, set the required attributes:

name "java"description "Install IBM Java on Ubuntu"default_attributes(  "java" => {    "install_flavor" => "ibm",    "ibm" => {      "accept_ibm_download_terms" => true,      "url" => "http://fileserver.example.com/ibm-java-x86_64-sdk-7.0-4.1.bin",      "checksum" => "The SHA256 checksum of the bin"    }  })run_list(  "recipe[java]")

Development

This cookbook usestest-kitchen forintegration tests andChefSpec/RSpec for unit tests.Pull requests should pass existing tests infiles/default/tests/minitest-handler.

At this time due to licensing concerns, the IBM recipe is not set upin test kitchen. If you would like to test this locally, copy.kitchen.yml to .kitchen.local.yml and add the following suite:

suites:- name: ibm  run_list: ["recipe[java]"]  attributes:    java:      install_flavor: "ibm"      ibm:        accept_ibm_download_terms: true        url: "http://jenkins/ibm-java-x86_64-sdk-7.0-4.1.bin"        checksum: the-sha256-checksum

Log into the IBM DeveloperWorks site to download a copy of the IBMJava SDK you wish to use/test, host it on an internal HTTP server, andcalculate the SHA256 checksum to use in the suite.

License and Author

Copyright: 2008-2013, Opscode, Inc

Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.

About

Development repository for Opscode Cookbook java

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp