In the past, the Oracle JDK used to be the best option, as OpenJDK was missing many features, had worse performance,
and didn't offer commercial support. However, in recent years, the differences between the JDKs in terms of features and
performance have become negligible and Oracle no longer allows you to use their JDK for free . Therefore, most teams are
now better off going with OpenJDK, which you can install using this module. Note that if you need commercial support for
the JDK, you may wish to use Azul or AdoptOpenJdk instead.
OS Version Compatibility
Not all versions of OpenJDK are available in the respective package repositories for each supported operating system.
The following Operating System and JDK versions are known to be available as of September, 2019:
Amazon Linux: 6, 7, 8
CentOS: 6, 7, 8, 11
Ubuntu 16.04: 6, 7, 8
Ubuntu 18.04: 8, 11
There is a good chance this will work with other operating systems (e.g Debian and RHEL) and JDK version combinations,
but our automated testing for this module does not cover these other distros at the moment.
The install-open-jdk module accepts the following arguments, all optional:
--version: The version of OpenJDK that you want installed. Currently we support only 6, 7 and 8. The default is 8.
Note that this script will automatically detect whether you are running an apt-based system like Debian/Ubuntu, or a
yum-based system like RHEL, CentOS, or Amazon Linux.
If you're using gruntwork-install to run this module, you can pass these arguments using --module-param arguments.
Example:
{"treedata":{"name":"root","toggled":true,"children":[{"name":".circleci","children":[{"name":"config.yml","path":".circleci/config.yml","sha":"c050ca0390cf497b7b66c9b20d454644fd07c433"}]},{"name":".gitignore","path":".gitignore","sha":"680445c9f2a64093b79e862110e7ba5a1631396b"},{"name":".pre-commit-config.yaml","path":".pre-commit-config.yaml","sha":"a231a87f4d53a3db368ba9a52c2ce4c72665be6c"},{"name":"CODEOWNERS","path":"CODEOWNERS","sha":"4be01a6334d39aa5bf6abe6baae701f5e2a8c5ac"},{"name":"LICENSE.txt","path":"LICENSE.txt","sha":"689cf10ec98e3297a75bdd9b9fb5da10b7a675f8"},{"name":"README.md","path":"README.md","sha":"70fb59469641fa364526a7ec8edb710befb3986d"},{"name":"examples","children":[{"name":"install-open-jdk","children":[{"name":"main.tf","path":"examples/install-open-jdk/main.tf","sha":"f31506fb8e3fbd065956d2423c95a713ac793bf3"},{"name":"outputs.tf","path":"examples/install-open-jdk/outputs.tf","sha":"6d1b9b915cdb10c8ba114d61d0c47f0babd2ebe8"},{"name":"packer","children":[{"name":"build.json","path":"examples/install-open-jdk/packer/build.json","sha":"a52ffa21b70d809026886f0c539de5340159102d"}]},{"name":"vars.tf","path":"examples/install-open-jdk/vars.tf","sha":"d1eba93458ba1cfdf6b588d968e558f756087e9f"}]},{"name":"zookeeper-ami","children":[{"name":"README.md","path":"examples/zookeeper-ami/README.md","sha":"05c95c33022491de1a986d0aca53019913a1f44a"},{"name":"configure-image.sh","path":"examples/zookeeper-ami/configure-image.sh","sha":"1284a3e34391d6d45e93ba03a325accad284c496"},{"name":"docker-compose.yml","path":"examples/zookeeper-ami/docker-compose.yml","sha":"4a19a656e2f87a6cbf054f03e561af25293cc50e"},{"name":"mock","children":[{"name":"README.md","path":"examples/zookeeper-ami/mock/README.md","sha":"281f2d6e28652e1269003052189206637f7a39e1"},{"name":"bash-commons","children":[{"name":"aws.sh","path":"examples/zookeeper-ami/mock/bash-commons/aws.sh","sha":"3410f13c4a89f2b9ebadef09c678a44471b57426"}]},{"name":"modules","children":[{"name":"attach-eni","path":"examples/zookeeper-ami/mock/modules/attach-eni","sha":"da052caea4586b27c2dc13e521092e9403fcc327"},{"name":"mount-ebs-volume","path":"examples/zookeeper-ami/mock/modules/mount-ebs-volume","sha":"e0171fef05dbd120dc8668ceeca176cc5c0dfce4"}]},{"name":"user-data","children":[{"name":"user-data.sh","path":"examples/zookeeper-ami/mock/user-data/user-data.sh","sha":"43a641aa2937ba6f7c07c8391c947de2f65b7920"}]}]},{"name":"zookeeper.json","path":"examples/zookeeper-ami/zookeeper.json","sha":"8c4b84869fd40a1db9bc8bef61d6b3a19b3762c0"}]},{"name":"zookeeper-cluster","children":[{"name":"README.md","path":"examples/zookeeper-cluster/README.md","sha":"eda7e80c820a57b327129083f52b73e0713ae6b3"},{"name":"main.tf","path":"examples/zookeeper-cluster/main.tf","sha":"73231469ead7422e5e018787801bc8074ae22155"},{"name":"outputs.tf","path":"examples/zookeeper-cluster/outputs.tf","sha":"b975f1a72a486b619e310e8140110b84dfc29085"},{"name":"user-data","children":[{"name":"user-data.sh","path":"examples/zookeeper-cluster/user-data/user-data.sh","sha":"e9791f80ed83847ba70305ce8ae5ef069f5c650a"}]},{"name":"vars.tf","path":"examples/zookeeper-cluster/vars.tf","sha":"ad3d6ba8d303e025fa8afd2a618510deeafd2e20"}]}]},{"name":"modules","children":[{"name":"bash-commons","children":[{"name":"README.md","path":"modules/bash-commons/README.md","sha":"36085f6f3d8ce299f64aa01f05761f60037a307b"},{"name":"install.sh","path":"modules/bash-commons/install.sh","sha":"aef9fac2b81593e7fe9bbc54c775d77883b78904"},{"name":"lib","children":[{"name":"assert.sh","path":"modules/bash-commons/lib/assert.sh","sha":"46db8af49acb3e8d707447827dc614740add6a63"},{"name":"aws.sh","path":"modules/bash-commons/lib/aws.sh","sha":"3f14d36e2c7b57c91be34bdf30fff4f400a7d1aa"},{"name":"log.sh","path":"modules/bash-commons/lib/log.sh","sha":"66f936873d4d104c94693d3e68790cc0b9d36c63"},{"name":"os.sh","path":"modules/bash-commons/lib/os.sh","sha":"435e592c0e992f2266247a2da797a0eefc429f35"},{"name":"strings.sh","path":"modules/bash-commons/lib/strings.sh","sha":"19dbfe630edfbe71e7c8c1beee3d50fffdd5b1e6"}]}]},{"name":"exhibitor-shared-config","children":[{"name":"README.md","path":"modules/exhibitor-shared-config/README.md","sha":"736686bba5c252be2acf0eb14a00dd59a23d72a0"},{"name":"main.tf","path":"modules/exhibitor-shared-config/main.tf","sha":"311599fba070613cebff664e67ae2ce8349d6d74"},{"name":"outputs.tf","path":"modules/exhibitor-shared-config/outputs.tf","sha":"f25b449e17b3d611d5248bd58499219511792c79"},{"name":"vars.tf","path":"modules/exhibitor-shared-config/vars.tf","sha":"627fa84d0ef4c7c765e312acc8d9ca775688ed4b"}]},{"name":"install-exhibitor","children":[{"name":"README.md","path":"modules/install-exhibitor/README.md","sha":"95b622d4e7ed592c3a1c042c387b3d1ece4c0747"},{"name":"install.sh","path":"modules/install-exhibitor/install.sh","sha":"e6041bd754a016778e56a18c9bff3108f7d84470"},{"name":"pom.xml","path":"modules/install-exhibitor/pom.xml","sha":"e5cca292196cdaa093cc484465eb5bc2d48ed618"},{"name":"zookeeper-log4j.properties","path":"modules/install-exhibitor/zookeeper-log4j.properties","sha":"80e3ae28555ed63b5a74d127796ff3f2adfce223"}]},{"name":"install-open-jdk","children":[{"name":"README.md","path":"modules/install-open-jdk/README.md","sha":"ecf31489edfe0016cd78d7bf6225056dd3981173","toggled":true},{"name":"install.sh","path":"modules/install-open-jdk/install.sh","sha":"63f6788b1d716303f54a865c6a03f659d2a60949"}],"toggled":true},{"name":"install-oracle-jdk","children":[{"name":"README.md","path":"modules/install-oracle-jdk/README.md","sha":"1e4be20a4464add964f1311b17da9e4e069bd2a8"},{"name":"install.sh","path":"modules/install-oracle-jdk/install.sh","sha":"681d9298e1c0809e0a5166673d499aea827539f1"}]},{"name":"install-supervisord","children":[{"name":"README.md","path":"modules/install-supervisord/README.md","sha":"5575c3cb66fcf12358a924249d5fec9febd275c2"},{"name":"install.sh","path":"modules/install-supervisord/install.sh","sha":"9a29cb5400e16f30a203e4e4d617dd2e51360594"},{"name":"supervisor-initd-script.sh","path":"modules/install-supervisord/supervisor-initd-script.sh","sha":"171b91613e98ab2bd10282025caff1707918c95a"},{"name":"supervisor-systemd-unit.service","path":"modules/install-supervisord/supervisor-systemd-unit.service","sha":"76b13943df6585299f93c101873bdfd81ca3fa19"},{"name":"supervisord.conf","path":"modules/install-supervisord/supervisord.conf","sha":"d96beb0ca9a16279ed1bdf74cbb6516275d85085"}]},{"name":"install-zookeeper","children":[{"name":"README.md","path":"modules/install-zookeeper/README.md","sha":"25009f48b77b50b22a6f3deae8235d640d457728"},{"name":"install.sh","path":"modules/install-zookeeper/install.sh","sha":"ff633d56374449a32523458932a772cc4f260ebb"},{"name":"security","children":[{"name":"zookeeper.KEYS","path":"modules/install-zookeeper/security/zookeeper.KEYS","sha":"f23552bd9489de0f229bb4bb27dfb6a0376904f4"},{"name":"zookeeper.asc","path":"modules/install-zookeeper/security/zookeeper.asc","sha":"de701fc5a9b18af3095d32de998b95d7f25667ef"}]}]},{"name":"run-exhibitor","children":[{"name":"README.md","path":"modules/run-exhibitor/README.md","sha":"473183248833afc4c2912d6abe1ab13ebc79f91d"},{"name":"bin","children":[{"name":"run-exhibitor","path":"modules/run-exhibitor/bin/run-exhibitor","sha":"3896b59705311166ff4320a166d586fcfad7a87b"}]},{"name":"install.sh","path":"modules/run-exhibitor/install.sh","sha":"2526ea9044211107baa2e01da2a27c55ab884ff7"}]},{"name":"run-health-checker","children":[{"name":"README.md","path":"modules/run-health-checker/README.md","sha":"4610cc44b430ad38e7ddf4475bcc2609bdbd5fbc"},{"name":"bin","children":[{"name":"check-zookeeper","path":"modules/run-health-checker/bin/check-zookeeper","sha":"c952376818aa1b3c08e6ce54c6b7b44811911696"},{"name":"run-health-checker","path":"modules/run-health-checker/bin/run-health-checker","sha":"3b663fa426632481b1e618285ef983cffd395809"}]},{"name":"install.sh","path":"modules/run-health-checker/install.sh","sha":"dc8cbdf7ef4a8e1feb96613adfd96bf5c7c1a29e"}]},{"name":"zookeeper-cluster","children":[{"name":"README.md","path":"modules/zookeeper-cluster/README.md","sha":"0567ae6a33387ef0a8afe59bad3b0bc6933d6b37"},{"name":"main.tf","path":"modules/zookeeper-cluster/main.tf","sha":"e134bea4660409dcb410a5564934a3a887fc5a53"},{"name":"outputs.tf","path":"modules/zookeeper-cluster/outputs.tf","sha":"424dada690378a4bd7aa8e903c61ad77746ebf99"},{"name":"vars.tf","path":"modules/zookeeper-cluster/vars.tf","sha":"8474ebfa78cc045581dbea258aba97b7fea65b42"}]},{"name":"zookeeper-iam-permissions","children":[{"name":"README.md","path":"modules/zookeeper-iam-permissions/README.md","sha":"2399cd6680bfbf24b2b13cca69048d06d6afc5ed"},{"name":"main.tf","path":"modules/zookeeper-iam-permissions/main.tf","sha":"3572ea5c426474b19f64dd50839449722b248273"},{"name":"vars.tf","path":"modules/zookeeper-iam-permissions/vars.tf","sha":"9c3a5c00d0591fd79c9e63b6c8bf753cc14cda61"}]},{"name":"zookeeper-security-group-rules","children":[{"name":"README.md","path":"modules/zookeeper-security-group-rules/README.md","sha":"dbc968a1d10180608a86efe6adfdb83f658be2b0"},{"name":"main.tf","path":"modules/zookeeper-security-group-rules/main.tf","sha":"ef54f638da4f84b8dc77a2371fd7ac625a75ddb5"},{"name":"vars.tf","path":"modules/zookeeper-security-group-rules/vars.tf","sha":"6319feab9b2eb4407d562436d716e64ef57b17fd"}]}],"toggled":true},{"name":"terraform-cloud-enterprise-private-module-registry-placeholder.tf","path":"terraform-cloud-enterprise-private-module-registry-placeholder.tf","sha":"ae586c0fe830819580e1009d41a9074f16e65bed"},{"name":"test","children":[{"name":"README.md","path":"test/README.md","sha":"a3b551ce00165ed25029229aae7a5ac5d9c33f91"},{"name":"go.mod","path":"test/go.mod","sha":"5331de1d0f74542edadd2797d897c9545072d764"},{"name":"go.sum","path":"test/go.sum","sha":"2ecc8f01ae9df11f47331af57d359b6cb726098a"},{"name":"open_jdk_test.go","path":"test/open_jdk_test.go","sha":"18e6c2f4c4e5c5a22ae4c85fb1934d6275858fb9"},{"name":"validation","children":[{"name":"validate_all_modules_and_examples_test.go","path":"test/validation/validate_all_modules_and_examples_test.go","sha":"74c928d0cbc2914e5cd708277bd857cb2375b660"}]},{"name":"zookeeper_cluster_test.go","path":"test/zookeeper_cluster_test.go","sha":"84fc388e44cd82e7cf52a5a8011ea2f4a37a7571"}]}]},"detailsContent":"<h1 class=\"preview__body--title\" id=\"install-open-jdk\">Install Open JDK</h1><div class=\"preview__body--border\"></div><p>This folder contains a script for installing the <a href=\"http://openjdk.java.net/\" class=\"preview__body--description--blue\" target=\"_blank\">OpenJDK</a>. The differences between\nthe Oracle's JDK and OpenJDK have <a href=\"https://stackoverflow.com/q/17360011/483528\" class=\"preview__body--description--blue\" target=\"_blank\">gotten smaller over the last few years</a>.</p>\n<p>In the past, the Oracle JDK used to be the best option, as OpenJDK was missing many features, had worse performance,\nand didn't offer commercial support. However, in recent years, the differences between the JDKs in terms of features and\nperformance have become negligible and Oracle no longer allows you to use their JDK for free . Therefore, most teams are\nnow better off going with OpenJDK, which you can install using this module. Note that if you need commercial support for\nthe JDK, you may wish to use Azul or AdoptOpenJdk instead.</p>\n<h2 class=\"preview__body--subtitle\" id=\"os-version-compatibility\">OS Version Compatibility</h2>\n<p>Not all versions of OpenJDK are available in the respective package repositories for each supported operating system.\nThe following Operating System and JDK versions are known to be available as of September, 2019:</p>\n<p><strong>Amazon Linux</strong>: 6, 7, 8</p>\n<p><strong>CentOS</strong>: 6, 7, 8, 11</p>\n<p><strong>Ubuntu 16.04</strong>: 6, 7, 8</p>\n<p><strong>Ubuntu 18.04</strong>: 8, 11</p>\n<p>There is a good chance this will work with other operating systems (e.g Debian and RHEL) and JDK version combinations,\nbut our automated testing for this module does not cover these other distros at the moment.</p>\n<h2 class=\"preview__body--subtitle\" id=\"quick-start\">Quick start</h2>\n<p>The easiest way to use this module is with the <a href=\"/repos/gruntwork-installer\" class=\"preview__body--description--blue\">Gruntwork Installer</a>:</p>\n<pre>gruntwork-install \\\n -<span class=\"ruby\">-<span class=\"hljs-class\"><span class=\"hljs-keyword\">module</span>-<span class=\"hljs-title\">name</span> \"<span class=\"hljs-title\">install</span>-<span class=\"hljs-title\">open</span>-<span class=\"hljs-title\">jdk</span>\" \\</span>\n</span> -<span class=\"ruby\">-repo <span class=\"hljs-string\">\"https://github.com/gruntwork-io/terraform-aws-zookeeper\"</span> \\\n</span> -<span class=\"ruby\">-tag <span class=\"hljs-string\">\"[LATEST_AVAILABLE_RELEASE]\"</span>\n</span></pre>\n<p>We recommend running this module as part of a <a href=\"https://www.packer.io/\" class=\"preview__body--description--blue\" target=\"_blank\">Packer</a> template to create an <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html\" class=\"preview__body--description--blue\" target=\"_blank\">Amazon Machine\nImage (AMI)</a> (see the <a href=\"/repos/v0.12.0/package-zookeeper/examples/zookeeper-ami\" class=\"preview__body--description--blue\">zookeeper-ami\nexample</a> for a fully-working sample code).</p>\n<h2 class=\"preview__body--subtitle\" id=\"command-line-arguments\">Command line Arguments</h2>\n<p>The <code>install-open-jdk</code> module accepts the following arguments, all optional:</p>\n<ul>\n<li><code>--version</code>: The version of OpenJDK that you want installed. Currently we support only 6, 7 and 8. The default is 8.</li>\n</ul>\n<p>Note that this script will automatically detect whether you are running an <code>apt</code>-based system like Debian/Ubuntu, or a\n<code>yum</code>-based system like RHEL, CentOS, or Amazon Linux.</p>\n<p>If you're using <code>gruntwork-install</code> to run this module, you can pass these arguments using <code>--module-param</code> arguments.\nExample:</p>\n<pre>gruntwork-install \\\n -<span class=\"ruby\">-<span class=\"hljs-class\"><span class=\"hljs-keyword\">module</span>-<span class=\"hljs-title\">name</span> \"<span class=\"hljs-title\">install</span>-<span class=\"hljs-title\">open</span>-<span class=\"hljs-title\">jdk</span>\" \\</span>\n</span> -<span class=\"ruby\">-repo <span class=\"hljs-string\">\"https://github.com/gruntwork-io/terraform-aws-zookeeper\"</span> \\\n</span> -<span class=\"ruby\">-tag <span class=\"hljs-string\">\"v0.2.0\"</span> \\\n</span> -<span class=\"ruby\">-<span class=\"hljs-class\"><span class=\"hljs-keyword\">module</span>-<span class=\"hljs-title\">param</span> \"<span class=\"hljs-title\">version</span>=7\" </span>\n</span></pre>\n","repoName":"package-zookeeper","repoRef":"v0.12.0","serviceDescriptor":{"serviceName":"Apache ZooKeeper","serviceRepoName":"package-zookeeper","serviceRepoOrg":"gruntwork-io","cloudProviders":["aws"],"description":"Deploy an Apache ZooKeeper cluster. Supports automatic bootstrap, Exhibitor, zero-downtime rolling deployment, and auto healing.","imageUrl":"zookeeper.png","licenseType":"subscriber","technologies":["Terraform","Bash"],"compliance":[],"tags":[""]},"serviceCategoryName":"NoSQL","fileName":"README.md","filePath":"/modules/install-open-jdk","title":"Repo Browser: Apache ZooKeeper","description":"Browse the repos in the Gruntwork Infrastructure as Code Library."}