GraalVM Enterprise on Oracle Cloud Infrastructure

Oracle Cloud Infrastructure (OCI) offers Oracle GraalVM Enterprise Edition for free for its customers. GraalVM Enterprise support is included in the Oracle Cloud subscription.

This guide focuses on using GraalVM Enterprise with Oracle Cloud Infrastructure Virtual Machine (VM) compute instance. If a user prefers a Bare Metal Machine instance, here is a documentation to peruse. For a complete beginner, start by creating and launching the first Linux instance tutorial.

There are two ways to set up GraalVM Enterprise environment in OCI VM instance:

Further below both configurations are described. For demonstration purposes, a demo-instance of the VM.Standard2.1 type with the Oracle Linux 7.7 pre-built image was created. The following SSH command is then used to connect to a Linux instance from a Unix-style system:

ssh -i .ssh/id_rsa opc@150.136.54.68

where .ssh/id_rsa is the full path and name of the file containing the private SSH key, opc is the default name for the Oracle Linux image, and 150.136.54.68 is the instance IP address provisioned from the console. For more details, refer to the Connecting to Your Linux Instance Using SSH tutorial.

Automatic Install with YUM

Oracle GraalVM Enterprise Edition RPMs have been made available in the OCI YUM repository for the product installation convenience. That means that OCI customers can use GraalVM Enterprise environment in their cloud instances by installing it with yum - a package-management utility for the Linux operating systems.

To demonstrate GraalVM Enterprise configuration using yum, a user should have created a compute VM instance and connected to it.

  1. Having connected to the instance, verify what GraalVM RPMs are available for the installation:
    sudo yum provides graalvm*
    ...
    

    Note, with newer releases of GraalVM Enterprise the repodata outdates and you may need to pull in the latest RPM packages. Run yum check-update to refresh.

  2. Having looked up a necessary RPM package name, install GraalVM Enterprise with sudo yum install <package_name>. The dependent packages, like libpolyglot, llvm etc., will also be resolved.
    sudo yum install graalvm19-ee-8-19.3.4-1.el7.x86_64
    

    If you have GraalVM Enterprise installed in your VM host already, the sudo yum install <package_name> command will not only install a preferred version, but also replace the old one. If you want to upgrade an existing package, run yum upgrade <package_name> and it will also remove the obsolete. The yum upgrade command will upgrade the whole system. After the installation, GraalVM Enterprise binary is placed in the root usr/lib64/graalvm directory.

  3. Next step is setting up environment variables to point to the GraalVM Enterprise directory. Check Java version:
    java -version
    java version "1.8.0_271"
    Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
    Java HotSpot(TM) 64-Bit GraalVM EE 19.3.4 (build 25.271-b09-jvmci-19.3-b18, mixed mode)
    

    Configure the PATH and JAVA_HOME environment variables in the bash configuration to point to GraalVM Enterprise for this SSH session with the following commands:

    echo "export JAVA_HOME=/usr/lib64/graalvm/graalvm19-ee-java8" >> ~/.bashrc
    echo "export PATH='$JAVA_HOME'/bin:'$PATH' " >> ~/.bashrc
    

    Then run source ~/.bashrc to activate this change and verify the result:

    source ~/.bashrc
    echo $JAVA_HOME
    echo $PATH
    
  4. To install additional GraalVM Enterprise language runtimes (Oracle GraalVM Enterprise Edition JDK8 Python runtime, etc.) or features (Oracle GraalVM Enterprise Edition JDK8 Native-Image, Oracle GraalVM Enterprise Edition JDK8 GraalVM LLVM Toolchain runtime), use the yum install <package_name> command syntax. For example:
    sudo yum install graalvm19-ee-java8-native-image
    

    Note, the Oracle GraalVM Enterprise Edition JDK8 R runtime and Oracle GraalVM Enterprise Edition JDK11 R runtime RPMs are not currently available in the OCI YUM repository.

Manual Transfer

A manual installation implies a transfer of GraalVM Enterprise files from a local machine to the virtual machine host. One way would be to copy the GraalVM Enterprise distribution from a local machine into every single virtual machine instance. However a more reasonable approach is to create a custom image that would have GraalVM Enterprise distribution and start your instances from it.

Having created a compute VM instance and connected to it, follow next steps to supply this instance with GraalVM Enterprise runtime.

  1. Download Oracle GraalVM Enterprise Edition from Oracle Technology Network.

  2. Copy GraalVM Enterprise from a local machine to your virtual machine instance:
    scp -i ~/.ssh/id_rsa graalvm-ee-linux-java8-amd64-19.3.4.tar.gz opc@150.136.54.68:/home/opc
    graalvm-ee-linux-amd64-19.3.4.tar.gz  100%  416MB   4.1MB/s   01:42
    
  3. Unpack the archive on the virtual machine:
    tar -xvzf graalvm-ee-linux-java8-amd64-19.3.4.tar.gz
    
  4. Set the environment variables to point to the GraalVM Enterprise directory. Check Java version:
    java -version
    java version "1.8.0_271"
    Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
    Java HotSpot(TM) 64-Bit GraalVM EE 19.3.4 (build 25.271-b09-jvmci-19.3-b18, mixed mode)
    

    Configure the PATH and JAVA_HOME environment variables in the bash configuration to point to GraalVM Enterprise for this SSH session with the following commands:

    echo "export JAVA_HOME=/usr/lib64/graalvm/graalvm19-ee-java8" >> ~/.bashrc
    echo "export PATH='$JAVA_HOME'/bin:'$PATH' " >> ~/.bashrc
    

    Then run source ~/.bashrc to activate this change and verify the result:

    source ~/.bashrc
    echo $JAVA_HOME
    echo $PATH
    

Having followed Automatic Install with YUM or Manual Transfer steps, you receive a ready-to-go VM instance with GraalVM Enterprise environment. OCI allows to create custom images of it, inheriting all parent’s environment settings:

  1. Return to the instance console.
  2. Expand “Actions” drop down menu and click “Create Custom Image”:
  3. Enter the name of your custom image and wait a few minutes.