GraalVM Enterprise in 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.

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

Further below both configurations are described.

Oracle Cloud Infrastructure offers two compute instance types:

In this guide a Virtual Machine (VM) instance type and Oracle Linux 7.7 as a pre-built image are used. 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.

For this demonstration the following SSH command is used to connect to a Linux instance from a Unix-style system:

$ ssh -i .ssh/id_rsa opc@129.146.64.22

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 129.146.64.22 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 are now available in the Oracle Cloud Infrastructure’s YUM repository. That means OCI customers can use GraalVM Enterprise runtime in their instances by simply installing it with yum.

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

  1. See what RPMs are available in the yum repository:
    [opc@custom-instance-5371 ~]$ sudo yum provides graalvm*
    Loaded plugins: langpacks, ulninfo
    graalvm19-ee-8-19.3.1-1.el7.x86_64 : Oracle GraalVM Enterprise Edition JDK8 Bundle
    Repo        : ol7_oci_included
    Matched from:
    Other       : graalvm19-ee-8 = 19.3.1
    Other       : graalvm19-ee-8(x86-64) = 19.3.1-1.el7
    Other       : graalvm19-ee-8 = 19.3.1-1.el7
    ...
    

    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 all dependencies. Note, you no longer need to manually set environment variables to point to the GraalVM Enterprise installation directory. The ~/.bashrc script is adjusted by yum.
    [opc@custom-instance-5371 ~]$ sudo yum install graalvm19-ee-8-19.3.1-1.el7.x86_64
    

    If you want to upgrade an existing package, it is recommended to use yum upgrade <package_name> as it will also remove the obsoletes. The yum upgrade command will upgrade the whole system.

  3. Check the Java version:
    [opc@custom-instance-5371 ~]$ java -version
    java version "1.8.0_241"
    Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
    Java HotSpot(TM) 64-Bit GraalVM EE 19.3.1 (build 25.241-b07-jvmci-19.3-b07, mixed mode)
    
  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) in this set up, use yum install <package_name> command syntax. For example:
    [opc@custom-instance-5371 ~]$ sudo yum install graalvm19-ee-8-native-image
    

    Warning: The Oracle GraalVM Enterprise Edition JDK8 R runtime and any of Oracle GraalVM Enterprise Edition based on JDK11 RPMs are not currently available in the Oracle Cloud Infrastructure’s YUM repository.

Manual Transfer

A manual configuration in OCI implies creating the virtual machine instances that will contain Oracle GraalVM Enterprise Edition. 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.1.tar.gz opc@129.146.64.22:/home/opc
    graalvm-ee-linux-amd64-19.3.1.tar.gz  100%  416MB   4.1MB/s   01:42
    
  3. Unpack the archive on the virtual machine:
    [opc@graalvm-image-builder-ol ~]$ tar -xvzf graalvm-ee-linux-java8-amd64-19.3.1.tar.gz
    
  4. Open ~/.bashrc profile in the virtual machine server to point environmental variables to GraalVM Enterprise:
    GRAALVM_VERSION=ee-19.3.1
    export GRAALVM_HOME=graalvm-$GRAALVM_VERSION
    export JAVA_HOME=$GRAALVM_HOME
    export PATH=$GRAALVM_HOME/bin:$PATH
    
  5. Run source ~/.bashrc to get these changes in the current session.
  6. Verify that it works:
    [opc@graalvm-image-builder-ol ~]$ which java
    ~/graalvm-ee-java8-19.3.1/bin/java
    [opc@graalvm-image-builder-ol ~]$ java -version
    java version "1.8.0_241"
    Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
    Java HotSpot(TM) 64-Bit GraalVM EE 19.3.1 (build 25.241-b07-jvmci-19.3-b07, mixed mode)
    
  7. Return to the instance console, expand “Actions” drop down menu and click “Create Custom Image”:
  8. Enter the name of your custom image and wait a few minutes.

Now you can start new instances with this custom image and they will have GraalVM Enterprise installed and ready.