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. For non Oracle Cloud clients, Oracle Cloud Free Tier program allows Oracle GraalVM Enterprise Edition trial usage.

This getting-started guide demonstrates how to configure GraalVM Enterprise environment in OCI to help users experience its capabilities in a virtual machine.

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

Further below both configurations are described, however the second way is recommended. For a complete beginner, start by creating a virtual machine instance in OCI.

Create a Virtual Machine Instance

Oracle Cloud Infrastructure offers two compute instance types:

In this guide a Virtual Machine (VM) instance type will be used. If a user prefers a Bare Metal Machine instance, here is a documentation to peruse.

  1. Log into your OCI account and proceed to Compute > Instance: Once redirected to a necessary compartment, press “Create Instance”.
  2. Give your instance a name, select the availability domain (accept the default), choose the operating system or image source and select Virtual Machine instance type. In this scenario, Oracle Linux 7.7 is used as a pre-built image.
  3. Pick the shape of the instance, configure networking (make sure to tick “Assign Public IP Address” option), add your SSH public key (to connect to instances using Oracle Linux, CentOS, or Ubuntu images you need to use the SSH key pair) and click “Create”. Note: A shape determines the number of CPUs, amount of memory, and other resources allocated to an instance. For the better performance optimizations, pick the shape of the instance that has several CPU available.
  4. Once the instance is provisioned and running, allow another few minutes for the operating system to boot. To connect to a Linux instance from a Unix-style system, use the following SSH command:
    $ ssh –i <private_key> <username>@<public-ip-address>
    

    Where <private_key> is the full path and name of the file that contains the private SSH key (make sure to set proper file permissions with chmod 400 <private_key>) and <username> is the default name for the instance. For Oracle Linux and CentOS images, the default user name is opc. For the Ubuntu image, the default name is ubuntu. The last <public-ip-address> is the instance IP address provisioned from the console: The expected output in this case is:

    $ ssh -i .ssh/id_rsa opc@129.146.64.22
    Warning: Permanently added '129.146.64.22' (ECDSA) to the list of known hosts.
    [opc@custom-instance-5371 ~]$
    

More detailed explanation on each step performed above can be found in the Launching Your First Linux Instance tutorial.

Manual Configuration

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 distribution and start your instances from it.

In the previous section you have 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-amd64-19.2.1.tar.gz opc@129.146.64.22:/home/opc
    graalvm-ee-linux-amd64-19.2.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-amd64-19.2.1.tar.gz
    
  4. Open ~/.bashrc profile in the virtual machine server to point environmental variables to GraalVM Enterprise:
    GRAALVM_VERSION=ee-19.2.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-19.2.1/bin/java
    [opc@graalvm-image-builder-ol ~]$ java -version
    java version "1.8.0_231"
    Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
    Java HotSpot(TM) 64-Bit GraalVM EE 19.2.1 (build 25.231-b11-jvmci-19.2-b03, 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.

Configuration 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, complete the steps in Create a Virtual Machine Instance section and connect to a newly created virtual machine instance.

  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.2.1-1.el7.x86_64 : Oracle GraalVM Enterprise Edition JDK8 Bundle
    Repo        : ol7_oci_included
    Matched from:
    Other       : graalvm19-ee-8 = 19.2.1
    Other       : graalvm19-ee-8(x86-64) = 19.2.1-1.el7
    Other       : graalvm19-ee-8 = 19.2.1-1.el7
    ...
    
  2. Having looked up a necessary RPM package name, install GraalVM Enterprise with all dependencies:
    [opc@custom-instance-5371 ~]$ sudo yum install graalvm19-ee-8-19.2.1-1.el7.x86_64
    

    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.

  3. Check the Java version:
    [opc@custom-instance-5371 ~]$ java -version
    java version "1.8.0_231"
    Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
    Java HotSpot(TM) 64-Bit GraalVM EE 19.2.1 (build 25.231-b11-jvmci-19.2-b03, mixed mode)
    
  4. To install additional GraalVM Enterprise language runtimes (Oracle GraalVM Enterprise Edition JDK8 Python runtime, Oracle GraalVM Enterprise Edition JDK8 Ruby runtime) or features (Oracle GraalVM Enterprise Edition JDK8 Native-Image) 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 Oracle GraalVM Enterprise Edition JDK8 LLVM Toolchain RPM packages are not currently available in the Oracle Cloud Infrastructure’s yum repository.