Compute

Setup OpenJDK in Oracle Linux 9.5 to use with EMCLI

Installing OpenJDK is a critical prerequisite for managing Oracle Enterprise Manager (OEM) via the Command Line Interface (EMCLI). Since EMCLI is a Java-based application, it requires a robust Java Runtime Environment (JRE) or Java Development Kit (JDK) to execute its core functions.

Section 1: OpenJDK Installation

First, we prepare the Oracle Linux 9.5 environment by updating the system and installing the OpenJDK 21 package.

sudo dnf update

Search for package in attached repositories.

sudo yum search java-21-openjdk

Install OpenJDK.

sudo dnf install java-21-openjdk

Verification

Confirm that Java is correctly installed and functional by checking the version and running a simple test program.

$ java -version

Create a simple Java program.

cat > Hello_World.java <<EOF
public class helloworld {
  public static void main(String[] args) {
    System.out.println("Hello Java User");
  }
}
EOF

Run the program.

$ java Hello_World.java
Hello Java User!

Section 2: EMCLI Installation and Configuration

With the Java foundation in place, we download the EMCLI client from the Oracle Management Server (OMS) and perform the installation.

Prepare the installation directory.

mkdir /u01/app/oracle/emcli
cd /u01/app/oracle/emcli

Download emcli package, as example from host oms-kestenholz.internal.

wget --no-check-certificate https://oms-kestenholz.internal:7803/em/public_lib_download/emcli/kit/emclikit.jar

Set Java environment variables.

export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-21.0.8.0.9-1.0.1.el9.x86_64
export PATH=$JAVA_HOME/bin:$PATH
$JAVA_HOME/bin/java -jar emclikit.jar -install_dir=/u01/app/oracle/emcli

Final Setup and Status Verification

Initialize the EMCLI by connecting it to your OMS and verify the final configuration state.

./emcli setup -url=https://oms-kestenholz.internal:7803/em -username=sysman -autologin -trustall

Get status.

./emcli status
Oracle Enterprise Manager 24ai Release 1 EM CLI.
Copyright (c) 1996, 2024 Oracle Corporation and/or its affiliates. All rights reserved.

Instance Home          : /home/oracle/.emcli
Verb Jars Home         : /u01/app/oracle/emcli/./bindings/24.1.0.0.0/.emcli
Status                 : Configured
EM CLI Home            : /u01/app/oracle/emcli/.
EM CLI Version         : 24.1.0.0.0
Java Home              : /opt/jdk-17
Java Version           : 17.0.2
Log file               : /home/oracle/.emcli/.emcli.log
Log level              : SEVERE
EM URL                 : https://<YOUR-OEM-HOSTNAME>:7803/em
EM user                : autoupgrade_user
Auto login             : true
Trust all certificates : true