简体   繁体   English

无法在 ubuntu 20.04.3 LTS 上安装 Graalvm 本机映像

[英]Can't install Graalvm native-image on ubuntu 20.04.3 LTS

I've just downloaded and installed graalvm-ce-java11-21.3.0.我刚刚下载并安装了 graalvm-ce-java11-21.3.0。 By default Native Image is not available, so I need to add it.默认情况下 Native Image 是不可用的,所以我需要添加它。 So I ran this command,所以我运行了这个命令,

gu install native-image

I got this error:我收到此错误:

Downloading: Release index file from oca.opensource.oracle.com
Downloading: Component catalog from www.graalvm.org
Processing Component: Native Image
Downloading: Component native-image: Native Image  from github.com
Installing new component: Native Image (org.graalvm.native-image, version 21.3.0)
Installation of Native Image failed: /home/deehaz/Downloads/graalvm-ce-java11-21.3.0/lib/graal_isolate.h: Operation not permitted
I/O error occurred: /home/deehaz/Downloads/graalvm-ce-java11-21.3.0/lib/graal_isolate.h: Operation not permitted

Please, can anyone tell me how to solve this?拜托,谁能告诉我如何解决这个问题?

How to Install GraalVM Community Edition on Linux如何在Linux上安装GraalVM社区版

Note: Tested on Ubuntu 20 only注意:仅在 Ubuntu 20 上测试

  1. Download the new release of GraalVM and unpack it anywhere in your filesystem:下载新版本的 GraalVM并将其解压到文件系统中的任何位置:
$wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java11-linux-amd64-22.0.0.2.tar.gz

$ tar -xvzf graalvm-ce-java11-linux-amd64-22.0.0.2.tar.gz
  1. Move the unpacked dir to /usr/lib/jvm/ and create a symbolic link to make your life easier when updating the GraalVM version:将解压后的目录移动到/usr/lib/jvm/并创建一个符号链接,让您在更新 GraalVM 版本时更轻松:

if the jvm folder does not exist run the command如果jvm文件夹不存在运行命令

$ mkdir /usr/lib/jvm
$ mv graalvm-ce-java11-linux-amd64-22.0.0.2/ /usr/lib/jvm/
$ cd /usr/lib/jvm
$ ln -s graalvm-ce-java11-linux-amd64-22.0.0.2 graalvm
  1. Configure ~/.bashrce:配置 ~/.bashrce:
$vim ~/.bashrc

paste the content粘贴内容

#gralvm configuration
export PATH=/usr/lib/jvm/graalvm/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/graalvm/

reload the edited file重新加载编辑后的文件

$ source ~/.bashrc
  1. Testing测试

To make sure everything is working fine, set the new JVM on your environment:为确保一切正常,请在您的环境中设置新的 JVM:

java -version

To verify, just check the version number:要验证,只需检查版本号:

openjdk version "11.0.14" 2022-01-18
OpenJDK Runtime Environment GraalVM CE 22.0.0.2 (build 11.0.14+9-jvmci-22.0-b05)
OpenJDK 64-Bit Server VM GraalVM CE 22.0.0.2 (build 11.0.14+9-jvmci-22.0-b05, mixed mode, sharing)

And you're set.你准备好了。

  1. install native-image.安装本机图像。
gu install native-image

hope i helped you..希望我帮助了你..

It seems i accidentally downloaded and extracted GraalVM installation as root and then tried to install Native Image as normal user.看来我不小心以 root 身份下载并提取了 GraalVM 安装,然后尝试以普通用户身份安装 Native Image。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM