Get Started with GraalVM Enterprise on OCI
Oracle Cloud Infrastructure (OCI) offers Oracle GraalVM Enterprise Edition for free to its customers. GraalVM Enterprise support is included in the Oracle Cloud subscription.
This guide focuses on using GraalVM Enterprise with the Oracle Cloud Infrastructure Virtual Machine (VM) compute instance. For users who prefer a Bare Metal Machine instance, see this documentation. For complete beginners, start with this tutorial for creating and launching your first Linux instance.
There are two ways to set up GraalVM Enterprise environment in the OCI VM instance:
- Automatic install of GraalVM Enterprise in a Linux operating virtual machine instance using the YUM command-line package-management utility
- Manual transfer of GraalVM Enterprise files from a local machine to a VM host
Both configurations are described below. 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
In this instance, .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
For convenient installation, Oracle GraalVM Enterprise Edition RPMs have been made available in the OCI YUM repository.
That means that OCI customers can use the GraalVM Enterprise environment in their cloud instances by installing it with yum
- a package-management utility for the Linux operating systems.
To demonstrate the GraalVM Enterprise configuration using yum
, a user should have created a compute VM instance and connected to it.
- Having connected to the instance, verify which GraalVM RPMs are available for the installation:
sudo yum provides graalvm20* ...
Note: With newer releases of GraalVM Enterprise, the repodata outdates. You may need to pull in the latest RPM packages. Run
yum check-update
to refresh. - Having found the appropriate 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 graalvm20-ee-8-20.3.0
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>
which will also remove the obsolete package.
The yum upgrade
command will upgrade the whole system.
After the installation, the GraalVM Enterprise binary is placed in the root usr/lib64/graalvm
directory.
- Next is setting up environment variables to point to the GraalVM Enterprise directory. Check Java version:
java -version java version "11.0.9" 2020-10-20 LTS Java(TM) SE Runtime Environment GraalVM EE 20.3.0 (build 11.0.9+7-LTS-jvmci-20.3-b05) Java HotSpot(TM) 64-Bit Server VM GraalVM EE 20.3.0 (build 11.0.9+7-LTS-jvmci-20.3-b05, mixed mode, sharing)
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/graalvm20-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
- 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 graalvm20-ee-8-native-image
Note: Oracle GraalVM Enterprise Edition JDK11 and JDK8 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 GraalVM Enterprise from a local machine into every single virtual machine instance. However a more efficient approach is to create a custom image that would have GraalVM Enterprise and start your instances from it.
Having created a compute VM instance and connected to it, follow the next steps to supply this instance with the GraalVM Enterprise runtime:
-
Download Oracle GraalVM Enterprise Edition from Oracle Technology Network.
- Copy GraalVM Enterprise from a local machine to your virtual machine instance:
scp -i ~/.ssh/id_rsa graalvm-ee-linux-java8-amd64-20.3.0.tar.gz opc@150.136.54.68:/home/opc graalvm-ee-linux-amd64-20.3.0.tar.gz 100% 416MB 4.1MB/s 01:42
- Unpack the archive on the virtual machine:
tar -xvzf graalvm-ee-linux-java8-amd64-20.3.0.tar.gz
- Set the environment variables to point to the GraalVM Enterprise directory. Check Java version:
java -version java version "11.0.9" 2020-10-20 LTS Java(TM) SE Runtime Environment GraalVM EE 20.3.0 (build 11.0.9+7-LTS-jvmci-20.3-b05) Java HotSpot(TM) 64-Bit Server VM GraalVM EE 20.3.0 (build 11.0.9+7-LTS-jvmci-20.3-b05, mixed mode, sharing)
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/graalvm20-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
After completing either the Automatic Install with YUM or the Manual Transfer, you will receive a ready-to-go VM instance with the GraalVM Enterprise environment. OCI allows you to create custom images of it, inheriting all of its parent’s environment settings:
- Return to the instance console.
- Expand the “Actions” drop down menu and click “Create Custom Image”:
- Enter the name of your custom image. It may take a few minutes for the custom image to be created.
For more information about working with your Oracle Cloud Infrastructure Compute instance continue reading to Overview of the Compute Service.