This post demonstrates how to install Java (JDK) 8 in Red Hat Enterprise Linux in AWS EC2.
- AWS Account
- Email address
- Provisioned EC2 instance with Red Hat Enterprise Linux AMI
Before proceeding, we need to perform the following steps:
Provision an EC2 Instance
This post will aid us in creating our server on AWS.
Convert .pem files to.pkk for putty
Installing Java (JDK) 8
Step 1: Install wget
Check if wget is already installed.
If not, install it.
Use the following command:
yum install wget
When the installation completes, we’ll have this:
Step 2: Download JDK from Oracle
At the time of writing, the latest version of Java is 1.8.0_144. The following command will download that version of JDK to our EC2.
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz"
When the download completes, we’ll have this:
Step 3: Extract and Copy to /opt
Use the following command to extract the contents of the .gz file.
tar xzf jdk-8u144-linux-x64.tar.gz
Then copy the extracted directory to /opt directory
Step 4: Add, or Update Symbolic Links
For java (executable):
For other executables or binaries.