Has anyone one come up with a good config script to install Oracle Java 1.7 in to an Elastic Beanstalk instance using the config files stored in .ebextensions. I am using a tomcat7 version of elastic beanstalk and I was able to install openJDK with yum using the following:
packages:
yum:
java-1.7.0-openjdk: []
java-1.7.0-openjdk-devel: []
commands:
use_java7:
command: alternatives --set java /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
How ever I would like to use Oracle Java 1.7 not OpenJDK and yum does not have that in it's repo natively.
try this configuration file
files:
"/home/ec2-user/install-oracle-jdk.sh":
mode: "000755"
owner: ec2-user
group: ec2-user
content: |
#!/usr/bin/env bash
wget -O jdk-7u25-linux-x64.rpm --no-cookies --no-check-certificate --header 'Cookie:gpw_e24=http://www.oracle.com; oraclelicense=accept-securebackup-cookie' 'http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.rpm'
rpm -Uvh /home/ec2-user/jdk-7u25-linux-x64.rpm
alternatives --install /usr/bin/java java /usr/java/default/bin/java 3
alternatives --set java /usr/java/default/bin/java
commands:
execute-install-oracle-jdk-script:
command: ./install-oracle-jdk.sh
cwd: /home/ec2-user
You could alternately install it as you would normally do and use this ami as your ami for creating new ec2 instances.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With