AlmaLinux 9 安装Oracle GraalVM Enterprise Edition 21.3.x

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

今天我们尝试一下在AlmaLinux 9 安装Oracle GraalVM Enterprise Edition 21.3.x。
GraalVM Enterprise 21 是一个 Long-Term-Support (LTS) 版本。
注意下载Oracle GraalVM Enterprise Edition需要有Oracle账户如果没有可以通过访问创建您的 Oracle 帐户进行创建。
在这里插入图片描述

step0. 支持的功能

适用于LinuxAMD64平台的GraalVM企业版的基本发行版包括启用了GraalVM编译器的Oracle JDK、LLVM和JavaScript运行模块。基本安装可以扩展为
在这里插入图片描述

Step1. 下载安装文件

访问https://www.oracle.com/downloads/graalvm-downloads.html下载

  • Oracle GraalVM Enterprise Edition Core (Oracle GraalVM企业版的核心组件。不包括Native Image和可选语言包。)
  • Oracle GraalVM Enterprise Edition Native Image (GraalVM Enterprise Native Image是一个ahead-of-time编译器)
  • GraalVM LLVM Toolchain Plugin (GraalVM组件包含LLVM工具链10.0.0)
  • Oracle GraalVM Enterprise Edition Node.js Runtime Plugin (使用GraalVM企业版实现JavaScript的Node.js版本)
    在这里插入图片描述

Step2. 安装Oracle GraalVM Enterprise Edition Core

编译native-image依赖于本地工具链。使用你的操作系统上的软件包管理器安装glibc-devel、zlib-develC库和zlib的头文件和gcc。一些Linux发行版可能还需要libstdc+±static。(注意这里不太确定libstdc+±static是否在AlmaLinux 9是否必须安装暂时先安装上后续继续观察)

sudo dnf --enablerepo=crb install -y libstdc++-static gcc glibc-devel zlib-devel

接下来开始正式安装解压文件

tar -xzf graalvm-ee-java17-linux-amd64-21.3.5.tar.gz

设置环境变量

export JAVA_HOME=<your_graalvm_ee_path>
export PATH=$JAVA_HOME/bin:$PATH

查看

java --version

输出示例

java 17.0.6 2023-01-17 LTS
Java(TM) SE Runtime Environment GraalVM EE 21.3.5 (build 17.0.6+9-LTS-jvmci-21.3-b27)
Java HotSpot(TM) 64-Bit Server VM GraalVM EE 21.3.5 (build 17.0.6+9-LTS-jvmci-21.3-b27, mixed mode, sharing)

Step3. 安装Oracle GraalVM Enterprise Edition Native Image

安装

gu -L install native-image-installable-svm-svmee-java17-linux-amd64-21.3.5.jar

输出示例

Processing Component archive: native-image-installable-svm-svmee-java17-linux-amd64-21.3.5.jar
Installing new component: Native Image (org.graalvm.native-image, version 21.3.5)

查看

gu list

输出示例

ComponentId              Version             Component name                Stability                     Origin
---------------------------------------------------------------------------------------------------------------------------------
graalvm                  21.3.5              GraalVM Core                  Supported
js                       21.3.5              Graal.js                      Supported
native-image             21.3.5              Native Image                  Early adopter

(Optional)卸载

gu remove native-image

(Optional)升级

gu upgrade --edition ee

Step4. 安装GraalVM LLVM Toolchain Plugin

安装

gu -L install llvm-toolchain-installable-java17-linux-amd64-21.3.5.jar

输出示例

Processing Component archive: llvm-toolchain-installable-java17-linux-amd64-21.3.5.jar
Installing new component: LLVM.org toolchain (org.graalvm.llvm-toolchain, version 21.3.5)

查看

gu list

输出示例

ComponentId              Version             Component name                Stability                     Origin
---------------------------------------------------------------------------------------------------------------------------------
graalvm                  21.3.5              GraalVM Core                  Supported
js                       21.3.5              Graal.js                      Supported
llvm-toolchain           21.3.5              LLVM.org toolchain            Supported
native-image             21.3.5              Native Image                  Early adopter

(Optional)卸载

gu remove llvm-toolchain

(Optional)升级

gu upgrade --edition ee

Step5. 安装Oracle GraalVM Enterprise Edition Node.js Runtime Plugin

安装

gu -L install nodejs-installable-svm-svmee-java17-linux-amd64-21.3.5.jar

输出示例

Processing Component archive: nodejs-installable-svm-svmee-java17-linux-amd64-21.3.5.jar
Installing new component: Graal.nodejs (org.graalvm.nodejs, version 21.3.5)

IMPORTANT NOTE:
---------------
Set of GraalVM components that provide language implementations have changed. The Polyglot native image and polyglot native C library may be out of sync:
- new languages may not be accessible
- removed languages may cause the native binary to fail on missing resources or libraries.
To rebuild and refresh the native binaries, use the following command:
        /u01/apps/java/graalvm-ee-java17-21.3.5/bin/gu rebuild-images

注意这里的IMPORTANT NOTE的影响不得而知后续继续观察。
查看

gu list

输出示例

ComponentId              Version             Component name                Stability                     Origin
---------------------------------------------------------------------------------------------------------------------------------
graalvm                  21.3.5              GraalVM Core                  Supported
js                       21.3.5              Graal.js                      Supported
llvm-toolchain           21.3.5              LLVM.org toolchain            Supported
native-image             21.3.5              Native Image                  Early adopter
nodejs                   21.3.5              Graal.nodejs                  Supported

(Optional)卸载

gu remove nodejs

(Optional)升级

gu upgrade --edition ee

参考文档

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: linuxoracle