Debian/GraalVM: Difference between revisions
Jump to navigation
Jump to search
(→Maven) |
|||
(18 intermediate revisions by the same user not shown) | |||
Line 59: | Line 59: | ||
| valign="top" | | | valign="top" | | ||
<source lang="bash"> | <source lang="bash"> | ||
sudo apt install openjdk-11-jre | sudo apt install openjdk-11-jre | ||
</source> | </source> | ||
| valign="top" | | | valign="top" | | ||
<source lang="bash"> | <source lang="bash"> | ||
sudo apt install openjdk-11-jdk | sudo apt install openjdk-11-jdk | ||
</source> | </source> | ||
Line 83: | Line 79: | ||
export ACADEMIA_HOME="$HOME/.chorke/academia" | export ACADEMIA_HOME="$HOME/.chorke/academia" | ||
mkdir -p $ACADEMIA_HOME/var/download | mkdir -p $ACADEMIA_HOME/var/download | ||
sudo mkdir -p /opt/cli | |||
mkdir -p /opt/cli | |||
</source> | </source> | ||
|- | |- | ||
Line 131: | Line 126: | ||
| valign="top"| | | valign="top"| | ||
<source lang="bash"> | <source lang="bash"> | ||
tar -xvzf $ACADEMIA_HOME/var/download/\ | sudo tar -xvzf $ACADEMIA_HOME/var/download/\ | ||
graalvm-ce-java11-linux-aarch64-21.3.0.tar.gz\ | graalvm-ce-java11-linux-aarch64-21.3.0.tar.gz\ | ||
-C /opt/cli | -C /opt/cli | ||
ln -s /opt/cli/graalvm-ce-java11-21.3.0\ | sudo ln -s /opt/cli/graalvm-ce-java11-21.3.0\ | ||
/usr/lib/jvm/graalvm-ce-java11-21.3.0 | /usr/lib/jvm/graalvm-ce-java11-21.3.0 | ||
update-alternatives --install /usr/bin/java java\ | sudo update-alternatives --install /usr/bin/java java\ | ||
/usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/java 1 | /usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/java 1 | ||
update-alternatives --install /usr/bin/javac javac\ | sudo update-alternatives --install /usr/bin/javac javac\ | ||
/usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/javac 1 | /usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/javac 1 | ||
update-alternatives --install /usr/bin/gu gu\ | sudo update-alternatives --install /usr/bin/gu gu\ | ||
/usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/gu 1 | /usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/gu 1 | ||
gu install native-image | sudo gu install native-image | ||
update-alternatives --install /usr/bin/native-image native-image\ | sudo update-alternatives --install /usr/bin/native-image native-image\ | ||
/usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/native-image 1 | /usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/native-image 1 | ||
Line 156: | Line 151: | ||
| valign="top" | | | valign="top" | | ||
<source lang="bash"> | <source lang="bash"> | ||
tar -xvzf $ACADEMIA_HOME/var/download/\ | sudo tar -xvzf $ACADEMIA_HOME/var/download/\ | ||
graalvm-ce-java17-linux-aarch64-21.3.0.tar.gz\ | graalvm-ce-java17-linux-aarch64-21.3.0.tar.gz\ | ||
-C /opt/cli | -C /opt/cli | ||
ln -s /opt/cli/graalvm-ce-java17-21.3.0\ | sudo ln -s /opt/cli/graalvm-ce-java17-21.3.0\ | ||
/usr/lib/jvm/graalvm-ce-java17-21.3.0 | /usr/lib/jvm/graalvm-ce-java17-21.3.0 | ||
update-alternatives --install /usr/bin/java java\ | sudo update-alternatives --install /usr/bin/java java\ | ||
/usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/java 2 | /usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/java 2 | ||
update-alternatives --install /usr/bin/javac javac\ | sudo update-alternatives --install /usr/bin/javac javac\ | ||
/usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/javac 2 | /usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/javac 2 | ||
update-alternatives --install /usr/bin/gu gu\ | sudo update-alternatives --install /usr/bin/gu gu\ | ||
/usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/gu 2 | /usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/gu 2 | ||
gu install native-image | sudo gu install native-image | ||
update-alternatives --install /usr/bin/native-image native-image\ | sudo update-alternatives --install /usr/bin/native-image native-image\ | ||
/usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/native-image 2 | /usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/native-image 2 | ||
Line 245: | Line 240: | ||
|} | |} | ||
== | ==Quarkus== | ||
{| | {| | ||
| | | | ||
<source lang="bash"> | |||
mkdir -p $ACADEMIA_HOME/dev && cd $ACADEMIA_HOME/dev | |||
git clone https://github.com/quarkusio/quarkus-quickstarts.git | |||
cd ./quarkus-quickstarts/getting-started | |||
</source> | |||
| | | | ||
<source lang="bash"> | |||
mvn compile quarkus:dev | |||
mvn package -Pnative | |||
mvn verify -Pnative | |||
</source> | |||
| | |- | ||
|colspan="2"| | |||
---- | |||
|- | |||
|colspan="2"| | |||
<source lang="bash"> | |||
upx -7 -k target/getting-started-1.0.0-SNAPSHOT-runner | |||
:' | |||
Ultimate Packer for eXecutables | |||
Copyright (C) 1996 - 2020 | |||
UPX 3.96 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 23rd 2020 | |||
File size Ratio Format Name | |||
-------------------- ------ ----------- ----------- | |||
1/5 [***************************................................] 26.6% / | |||
' | |||
</source> | |||
|- | |- | ||
| | |colspan="2"| | ||
---- | ---- | ||
|- | |- | ||
|colspan="2"| | |||
<source lang="bash"> | |||
ls -lah target/ | |||
:' | |||
5.6K getting-started-1.0.0-SNAPSHOT.jar | |||
4.0K getting-started-1.0.0-SNAPSHOT-native-image-source-jar | |||
40.0M getting-started-1.0.0-SNAPSHOT-runne~ | |||
13.0M getting-started-1.0.0-SNAPSHOT-runner | |||
' | |||
</source> | |||
|} | |||
==Knowledge== | |||
{| | |||
|valign="top"| | |valign="top"| | ||
sudo | sudo apt install snapd | ||
sudo systemctl status snapd | sudo systemctl status snapd | ||
sudo systemctl enable snapd | sudo systemctl enable snapd | ||
Line 299: | Line 320: | ||
|valign="top"| | |valign="top"| | ||
apt-cache madison docker-ce | |||
docker build -f src/main/docker/Dockerfile.native\ | |||
-t quarkus-quickstart/getting-started . | -t quarkus-quickstart/getting-started . | ||
Line 313: | Line 334: | ||
|valigan="top"| | |valigan="top"| | ||
docker network ls | |||
docker image ls | |||
docker ps -a | |||
|valign="top"| | |valign="top"| | ||
Line 328: | Line 349: | ||
|valign="top"| | |valign="top"| | ||
$GRAALVM_HOME/bin/gu install native-image | $GRAALVM_HOME/bin/gu install native-image | ||
sudo | sudo apt install icedtea-netx default-jdk | ||
sudo alternatives --config java | sudo update-alternatives --config java | ||
| valign="top" | | | valign="top" | | ||
Line 350: | Line 371: | ||
|- | |- | ||
|valign="top" colspan="2"| | |valign="top" colspan="2"| | ||
ssh-keygen -f "/home/chorke/.ssh/known_hosts" -R "10.19.83.111" | |||
ssh-keygen -f ~/.ssh/known_hosts -R 10.19.83.111 | |||
|valign="bottom"| | |||
apt search upx | |||
sudo apt install upx-ucl | |||
|- | |||
| valign="top" colspan="3" | | |||
---- | |||
|- | |||
| valign="top" colspan="2" | | |||
<source lang="bash"> | <source lang="bash"> | ||
upx -7 -k target/java-native-apps-1.0.0.GA | upx -7 -k target/java-native-apps-1.0.0.GA | ||
Line 357: | Line 390: | ||
UPX 3.96 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 23rd 2020 | UPX 3.96 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 23rd 2020 | ||
File size Ratio Format Name | |||
-------------------- ------ ----------- ----------- | |||
1/5 [***************************................................] 26.6% / | |||
' | ' | ||
</source> | </source> | ||
|valign=" | | valign="top" | | ||
|} | |} | ||
Line 393: | Line 424: | ||
* [[Ubuntu/Raspberry Pi]] | * [[Ubuntu/Raspberry Pi]] | ||
* [[Ubuntu/GraalVM]] | * [[Ubuntu/GraalVM]] | ||
* [[ | * [[Fedora/GraalVM]] | ||
| valign="top" | | | valign="top" | | ||
Line 413: | Line 444: | ||
* [https://pkgs.alpinelinux.org/package/v3.15/main/aarch64/libc6-compat <code>glibc</code> compatibility libraries for Alpine <code>AArch64</code>] | * [https://pkgs.alpinelinux.org/package/v3.15/main/aarch64/libc6-compat <code>glibc</code> compatibility libraries for Alpine <code>AArch64</code>] | ||
* [https://pkgs.alpinelinux.org/package/v3.15/main/x86_64/libc6-compat <code>glibc</code> compatibility libraries for Alpine <code>x86_64</code>] | * [https://pkgs.alpinelinux.org/package/v3.15/main/x86_64/libc6-compat <code>glibc</code> compatibility libraries for Alpine <code>x86_64</code>] | ||
* [https://blog.softwaremill.com/small-fast-docker-images-using-graalvms-native-image-99c0bc92e70b Small & fast Docker images using GraalVM] | |||
* [https://www.batey.info/graalvm-docker-small-images.html Tiny docker images for Java with GraalVM] | |||
* [https://zeringue.io/post/graalvm-gradle-docker/ Build Slim Java Native Container] | |||
* [https://www.graalvm.org/reference-manual/native-image/StaticImages/ Static & Mostly Static Images] | |||
* [https://pkgs.alpinelinux.org/packages?name=musl&branch=v3.15 Alpine <code>musl libc</code> apk] | |||
* [[MacOS/GraalVM]] | |||
* [[Raspberry Pi]] | |||
* [[GraalVM]] | |||
| valign="top" | | | valign="top" | |
Latest revision as of 08:20, 11 March 2022
| |
Network Config: cat <<EOF > /Volumes/boot/wpa_supplicant.conf
country=MY
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
scan_ssid=1
ssid="ChorkeOrg_2.4GHz"
psk="sadaqah!"
}
EOF
|
System Update: sudo apt update
sudo apt list --upgradable
sudo apt upgrade
systemctl list-unit-files
systemctl daemon-reload
sudo nmcli dev wifi con 'ChorkeOrg' password 'sadaqah!'
sudo nmcli dev wifi rescan
sudo nmcli dev wifi
sudo nmcli con
|
| |
Timezone: sudo timedatectl set-timezone 'Asia/Kuala_Lumpur' sudo timedatectl set-time '2010-10-10 10:10:10' sudo hostnamectl set-hostname debian sudo timedatectl set-ntp true |
Cockpit: https://10.19.83.111:9090/ https://10.19.83.211:9090/ http://10.19.83.111/ http://10.19.83.211/ |
Install
sudo apt install openjdk-11-jre
|
sudo apt install openjdk-11-jdk
|
| |
sudo apt install build-essential libz-dev zlib1g-dev
sudo apt install git
sudo su
export ACADEMIA_HOME="$HOME/.chorke/academia"
mkdir -p $ACADEMIA_HOME/var/download
sudo mkdir -p /opt/cli
| |
| |
mkdir -p $ACADEMIA_HOME/etc/env/
cat << \EOF >> $ACADEMIA_HOME/etc/env/system.sh
# chorke academia env
export ACADEMIA_HOME="$HOME/.chorke/academia"
export ACADEMIA_DEV="$ACADEMIA_HOME/dev"
EOF
|
cat << \EOF >> $HOME/.bashrc
# chorke academia env
if [ -f "$HOME/.chorke/academia/etc/env/system.sh" ]; then
source $HOME/.chorke/academia/etc/env/system.sh
fi
EOF
|
| |
wget -c https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/\
graalvm-ce-java11-linux-aarch64-21.3.0.tar.gz -P $ACADEMIA_HOME/var/download
wget -c https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/\
graalvm-ce-java17-linux-aarch64-21.3.0.tar.gz -P $ACADEMIA_HOME/var/download
| |
| |
sudo tar -xvzf $ACADEMIA_HOME/var/download/\
graalvm-ce-java11-linux-aarch64-21.3.0.tar.gz\
-C /opt/cli
sudo ln -s /opt/cli/graalvm-ce-java11-21.3.0\
/usr/lib/jvm/graalvm-ce-java11-21.3.0
sudo update-alternatives --install /usr/bin/java java\
/usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac\
/usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/javac 1
sudo update-alternatives --install /usr/bin/gu gu\
/usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/gu 1
sudo gu install native-image
sudo update-alternatives --install /usr/bin/native-image native-image\
/usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/native-image 1
export GRAALVM_HOME=/usr/lib/jvm/graalvm-ce-java11-21.3.0
|
sudo tar -xvzf $ACADEMIA_HOME/var/download/\
graalvm-ce-java17-linux-aarch64-21.3.0.tar.gz\
-C /opt/cli
sudo ln -s /opt/cli/graalvm-ce-java17-21.3.0\
/usr/lib/jvm/graalvm-ce-java17-21.3.0
sudo update-alternatives --install /usr/bin/java java\
/usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/java 2
sudo update-alternatives --install /usr/bin/javac javac\
/usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/javac 2
sudo update-alternatives --install /usr/bin/gu gu\
/usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/gu 2
sudo gu install native-image
sudo update-alternatives --install /usr/bin/native-image native-image\
/usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/native-image 2
export GRAALVM_HOME=/usr/lib/jvm/graalvm-ce-java17-21.3.0
|
| |
sudo update-alternatives --config native-image
sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config gu
ls -lah /usr/lib/jvm
|
Maven
sudo apt install maven
|
sudo apt install ant
|
sudo apt install ivy
|
| ||
<profile>
<id>native-image-fargate</id>
<build>
<plugins>
<plugin>
<groupId>com.oracle.substratevm</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>${graal.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<mainClass>${vertx.verticle}</mainClass>
<imageName>${project.artifactId}</imageName>
<buildArgs>--enable-all-security-services -H:+ReportUnsupportedElementsAtRuntime --allow-incomplete-classpath</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
|
Quarkus
mkdir -p $ACADEMIA_HOME/dev && cd $ACADEMIA_HOME/dev
git clone https://github.com/quarkusio/quarkus-quickstarts.git
cd ./quarkus-quickstarts/getting-started
|
mvn compile quarkus:dev
mvn package -Pnative
mvn verify -Pnative
|
| |
upx -7 -k target/getting-started-1.0.0-SNAPSHOT-runner
:'
Ultimate Packer for eXecutables
Copyright (C) 1996 - 2020
UPX 3.96 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 23rd 2020
File size Ratio Format Name
-------------------- ------ ----------- -----------
1/5 [***************************................................] 26.6% /
'
| |
| |
ls -lah target/
:'
5.6K getting-started-1.0.0-SNAPSHOT.jar
4.0K getting-started-1.0.0-SNAPSHOT-native-image-source-jar
40.0M getting-started-1.0.0-SNAPSHOT-runne~
13.0M getting-started-1.0.0-SNAPSHOT-runner
'
|
Knowledge
sudo apt install snapd sudo systemctl status snapd sudo systemctl enable snapd |
sudo snap install lxd sudo systemctl status snapd sudo systemctl restart snapd |
lxc image list images: archlinux arm64 lxc image list images: ubuntu arm64 lxc image list images: alpine arm64 |
| ||
lxc launch images:opensuse/15.3 agronomy lxc launch images:apertis/v2021 robotics lxc launch images:alpine/3.15 academia |
lxc exec academia sh lxc exec agronomy sh lxc exec robotics sh |
apt-cache madison docker-ce docker build -f src/main/docker/Dockerfile.native\ -t quarkus-quickstart/getting-started . |
| ||
lxc network show lxdbr0 lxc network list lxc image list |
docker network ls docker image ls docker ps -a |
export GRAALVM_HOME=/opt/cli/graalvm-ce-java11-21.3.0 mvn compile quarkus:dev mvn package -Pnative |
| ||
$GRAALVM_HOME/bin/gu install native-image sudo apt install icedtea-netx default-jdk sudo update-alternatives --config java |
sudo apt install openjdk-8-jre
sudo apt install openjdk-11-jre
sudo apt install openjdk-17-jre
|
sudo apt install openjdk-8-jdk
sudo apt install openjdk-11-jdk
sudo apt install openjdk-17-jdk
|
| ||
ssh-keygen -f "/home/chorke/.ssh/known_hosts" -R "10.19.83.111" ssh-keygen -f ~/.ssh/known_hosts -R 10.19.83.111 |
apt search upx sudo apt install upx-ucl | |
| ||
upx -7 -k target/java-native-apps-1.0.0.GA
:'
Ultimate Packer for eXecutables
Copyright (C) 1996 - 2020
UPX 3.96 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 23rd 2020
File size Ratio Format Name
-------------------- ------ ----------- -----------
1/5 [***************************................................] 26.6% /
'
|