Java 17(Open JDK)をインストールする!(Rocky Linux 9)

Rocky Linux9に、Java 17(OpenJDK)をインストールします。

インストールする環境を確認する!

Java 17をインストールする環境を確認します。

# hostnamectl
 Static hostname: vmsapp11.loc.lab4ict.com
       Icon name: computer-vm
         Chassis: vm
      Machine ID: b562ef5fa24c465d81798fd3224943d6
         Boot ID: fe715e2608724cbfa9e85850b3d3acfb
  Virtualization: oracle
Operating System: Rocky Linux 9.2 (Blue Onyx)       
     CPE OS Name: cpe:/o:rocky:rocky:9::baseos
          Kernel: Linux 5.14.0-284.11.1.el9_2.x86_64
    Architecture: x86-64
 Hardware Vendor: innotek GmbH
  Hardware Model: VirtualBox
Firmware Version: VirtualBox

Java 17をインストールする!

dnfコマンドでJava 17をインストールします。

# dnf -y install java-17-openjdk
Last metadata expiration check: 0:31:38 ago on Mon 12 Jun 2023 06:15:47 AM JST.
Dependencies resolved.
========================================================================================================================
 Package                                   Architecture  Version                                 Repository        Size
========================================================================================================================
Installing:
 java-17-openjdk                           x86_64        1:17.0.7.0.7-3.el9                      appstream        435 k
Installing dependencies:
 ModemManager-glib                         x86_64        1.20.2-1.el9                            baseos           334 k
 adwaita-cursor-theme                      noarch        40.1.1-3.el9                            appstream        623 k
 adwaita-icon-theme                        noarch        40.1.1-3.el9                            appstream         11 M
 alsa-lib                                  x86_64        1.2.8-3.el9                             appstream        498 k
 at-spi2-atk                               x86_64        2.38.0-4.el9                            appstream         86 k
 at-spi2-core                              x86_64        2.40.3-1.el9                            appstream        176 k
 atk                                       x86_64        2.36.0-5.el9                            appstream        270 k
 avahi-glib                                x86_64        0.8-12.el9                              appstream         14 k
 bluez-libs                                x86_64        5.64-2.el9                              baseos            83 k
 bubblewrap                                x86_64        0.4.1-6.el9                             baseos            49 k
 colord-libs                               x86_64        1.4.5-4.el9                             appstream        230 k
 copy-jdk-configs                          noarch        4.0-3.el9                               appstream         27 k
 cups-libs                                 x86_64        1:2.3.3op2-16.el9                       baseos           264 k
 exempi                                    x86_64        2.6.0-0.2.20211007gite23c213.el9        appstream        523 k
 exiv2-libs                                x86_64        0.27.5-2.el9                            appstream        779 k
 fdk-aac-free                              x86_64        2.0.0-8.el9                             appstream        324 k
 flac-libs                                 x86_64        1.3.3-10.el9                            appstream        218 k
 flatpak-selinux                           noarch        1.12.7-2.el9                            appstream         22 k
 flatpak-session-helper                    x86_64        1.12.7-2.el9                            appstream         75 k
 fuse                                      x86_64        2.9.9-15.el9                            baseos            79 k
 gdk-pixbuf2-modules                       x86_64        2.42.6-3.el9                            appstream         84 k
 geoclue2                                  x86_64        2.6.0-7.el9                             appstream        122 k
 giflib                                    x86_64        5.2.1-9.el9                             appstream         48 k
 graphene                                  x86_64        1.10.6-2.el9                            appstream         64 k
 gsm                                       x86_64        1.0.19-6.el9                            appstream         33 k
 gstreamer1                                x86_64        1.18.4-4.el9                            appstream        1.4 M
 gstreamer1-plugins-base                   x86_64        1.18.4-5.el9.0.1                        appstream        2.0 M
 gtk-update-icon-cache                     x86_64        3.24.31-2.el9                           appstream         34 k
 hicolor-icon-theme                        noarch        0.17-13.el9                             appstream         66 k
 iso-codes                                 noarch        4.6.0-3.el9                             appstream        3.3 M
 java-17-openjdk-headless                  x86_64        1:17.0.7.0.7-3.el9                      appstream         42 M
 javapackages-filesystem                   noarch        6.0.0-4.el9                             appstream         11 k
 jbigkit-libs                              x86_64        2.1-23.el9                              appstream         52 k
 lcms2                                     x86_64        2.12-3.el9                              appstream        166 k
 libX11-xcb                                x86_64        1.7.0-7.el9                             appstream         11 k
 libXcomposite                             x86_64        0.4.5-7.el9                             appstream         23 k
 libXcursor                                x86_64        1.2.0-7.el9                             appstream         30 k
 libXdamage                                x86_64        1.1.5-7.el9                             appstream         22 k
 libXfixes                                 x86_64        5.0.3-16.el9                            appstream         19 k
 libXi                                     x86_64        1.7.10-8.el9                            appstream         39 k
 libXinerama                               x86_64        1.1.4-10.el9                            appstream         14 k
 libXrandr                                 x86_64        1.5.2-8.el9                             appstream         27 k
 libXtst                                   x86_64        1.2.3-16.el9                            appstream         20 k
 libXv                                     x86_64        1.0.11-16.el9                           appstream         18 k
 libXxf86vm                                x86_64        1.1.4-18.el9                            appstream         18 k
 libasyncns                                x86_64        0.8-22.el9                              appstream         29 k
 libcanberra                               x86_64        0.30-26.el9                             appstream         86 k
 libdrm                                    x86_64        2.4.114-1.el9                           appstream        158 k
 libepoxy                                  x86_64        1.5.5-4.el9                             appstream        244 k
 libexif                                   x86_64        0.6.22-6.el9                            appstream        423 k
 libfontenc                                x86_64        1.1.3-17.el9                            appstream         30 k
 libgexiv2                                 x86_64        0.12.3-1.el9                            appstream         81 k
 libglvnd                                  x86_64        1:1.3.4-1.el9                           appstream        133 k
 libglvnd-egl                              x86_64        1:1.3.4-1.el9                           appstream         36 k
 libglvnd-glx                              x86_64        1:1.3.4-1.el9                           appstream        140 k
 libgsf                                    x86_64        1.14.47-5.el9                           appstream        245 k
 libgxps                                   x86_64        0.3.2-3.el9                             appstream         78 k
 libiptcdata                               x86_64        1.0.5-9.el9                             appstream         61 k
 libldac                                   x86_64        2.0.2.3-10.el9                          appstream         40 k
 libnotify                                 x86_64        0.7.9-8.el9                             appstream         43 k
 libogg                                    x86_64        2:1.3.4-6.el9                           appstream         32 k
 libosinfo                                 x86_64        1.10.0-1.el9                            appstream        312 k
 libpciaccess                              x86_64        0.16-6.el9                              baseos            27 k
 libsbc                                    x86_64        1.4-9.el9                               appstream         44 k
 libsndfile                                x86_64        1.0.31-7.el9                            appstream        206 k
 libtheora                                 x86_64        1:1.1.1-31.el9                          appstream        163 k
 libtiff                                   x86_64        4.4.0-7.el9                             appstream        195 k
 libtool-ltdl                              x86_64        2.4.6-45.el9                            appstream         36 k
 libtracker-sparql                         x86_64        3.1.2-3.el9_1                           appstream        316 k
 libvisual                                 x86_64        1:0.4.0-34.el9                          appstream        143 k
 libvorbis                                 x86_64        1:1.3.7-5.el9                           appstream        192 k
 libwayland-client                         x86_64        1.21.0-1.el9                            appstream         33 k
 libwayland-cursor                         x86_64        1.21.0-1.el9                            appstream         18 k
 libwayland-egl                            x86_64        1.21.0-1.el9                            appstream         12 k
 libwayland-server                         x86_64        1.21.0-1.el9                            appstream         41 k
 libwebp                                   x86_64        1.2.0-6.el9_1.0.1                       appstream        275 k
 libxkbcommon                              x86_64        1.0.3-4.el9                             appstream        132 k
 libxshmfence                              x86_64        1.3-10.el9                              appstream         12 k
 lksctp-tools                              x86_64        1.0.19-2.el9                            baseos            90 k
 llvm-libs                                 x86_64        15.0.7-1.el9                            appstream         21 M
 low-memory-monitor                        x86_64        2.1-4.el9                               appstream         35 k
 lua                                       x86_64        5.4.4-3.el9                             appstream        187 k
 lua-posix                                 x86_64        35.0-8.el9                              appstream        131 k
 mesa-libEGL                               x86_64        22.3.0-2.el9                            appstream        124 k
 mesa-libGL                                x86_64        22.3.0-2.el9                            appstream        168 k
 mesa-libgbm                               x86_64        22.3.0-2.el9                            appstream         37 k
 mesa-libglapi                             x86_64        22.3.0-2.el9                            appstream         49 k
 mesa-vulkan-drivers                       x86_64        22.3.0-2.el9                            appstream        7.4 M
 mkfontscale                               x86_64        1.2.1-3.el9                             appstream         31 k
 openjpeg2                                 x86_64        2.4.0-7.el9                             appstream        162 k
 opus                                      x86_64        1.3.1-10.el9                            appstream        199 k
 orc                                       x86_64        0.4.31-6.el9                            appstream        183 k
 osinfo-db                                 noarch        20221130-1.el9                          appstream        265 k
 osinfo-db-tools                           x86_64        1.10.0-1.el9                            appstream         68 k
 ostree-libs                               x86_64        2022.6-3.el9                            appstream        435 k
 pipewire-libs                             x86_64        0.3.47-3.el9_2                          appstream        1.5 M
 poppler                                   x86_64        21.01.0-14.el9                          appstream        1.1 M
 poppler-data                              noarch        0.4.9-9.el9.0.1                         appstream        1.8 M
 poppler-glib                              x86_64        21.01.0-14.el9                          appstream        152 k
 pulseaudio-libs                           x86_64        15.0-2.el9                              appstream        666 k
 pulseaudio-utils                          x86_64        15.0-2.el9                              appstream         72 k
 rtkit                                     x86_64        0.11-28.el9                             appstream         55 k
 sound-theme-freedesktop                   noarch        0.8-17.el9                              appstream        377 k
 totem-pl-parser                           x86_64        3.26.6-2.el9                            appstream        130 k
 tracker                                   x86_64        3.1.2-3.el9_1                           appstream        538 k
 ttmkfdir                                  x86_64        3.0.9-65.el9                            appstream         52 k
 tzdata-java                               noarch        2023c-1.el9                             appstream        149 k
 upower                                    x86_64        0.99.13-2.el9                           appstream        165 k
 vulkan-loader                             x86_64        1.3.239.0-1.el9                         appstream        138 k
 webrtc-audio-processing                   x86_64        0.3.1-8.el9                             appstream        304 k
 wireplumber                               x86_64        0.4.8-1.el9                             appstream         73 k
 wireplumber-libs                          x86_64        0.4.8-1.el9                             appstream        316 k
 xdg-dbus-proxy                            x86_64        0.1.3-1.el9                             appstream         41 k
 xdg-desktop-portal                        x86_64        1.12.4-1.el9                            appstream        366 k
 xkeyboard-config                          noarch        2.33-2.el9                              appstream        779 k
 xorg-x11-fonts-Type1                      noarch        7.5-33.el9                              appstream        499 k
Installing weak dependencies:
 dconf                                     x86_64        0.40.0-6.el9                            appstream        109 k
 exiv2                                     x86_64        0.27.5-2.el9                            appstream        975 k
 flatpak                                   x86_64        1.12.7-2.el9                            appstream        1.7 M
 gtk3                                      x86_64        3.24.31-2.el9                           appstream        4.8 M
 libcanberra-gtk3                          x86_64        0.30-26.el9                             appstream         31 k
 p11-kit-server                            x86_64        0.24.1-2.el9                            appstream        194 k
 pipewire                                  x86_64        0.3.47-3.el9_2                          appstream         30 k
 pipewire-alsa                             x86_64        0.3.47-3.el9_2                          appstream         53 k
 pipewire-jack-audio-connection-kit        x86_64        0.3.47-3.el9_2                          appstream        125 k
 pipewire-pulseaudio                       x86_64        0.3.47-3.el9_2                          appstream         18 k
 tracker-miners                            x86_64        3.1.2-3.el9                             appstream        887 k
 xdg-desktop-portal-gtk                    x86_64        1.12.0-3.el9                            appstream        130 k

Transaction Summary
========================================================================================================================
Install  129 Packages

Total download size: 118 M
...
Complete!

Javaのバージョンを確認する!

Java 17であることを確認します。

# java -version
openjdk version "17.0.7" 2023-04-18 LTS
OpenJDK Runtime Environment (Red_Hat-17.0.7.0.7-2) (build 17.0.7+7-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.7.0.7-2) (build 17.0.7+7-LTS, mixed mode, sharing)

Javaコマンドのパスを確認する!

環境変数への登録等のため、javaコマンドのパスを確認しておきます。

# which java
/usr/bin/java

おわりに

Rocky Linuxに、Java 17(OpenJDK)を指定してJavaをインストールしました。