# 1. update your system [root@thermalite ~]# dnf update -y Repository packages-microsoft-com-prod is listed more than once in the configuration Last metadata expiration check: 0:00:11 ago on Sat 29 Jan 2022 09:07:32 AM EST. Dependencies resolved. ============================================================================================================= Package Arch Version Repository Size ============================================================================================================= Upgrading: java-1.8.0-openjdk x86_64 1:1.8.0.322.b06-2.el8_5 appstream 341 k java-1.8.0-openjdk-devel x86_64 1:1.8.0.322.b06-2.el8_5 appstream 9.8 M java-1.8.0-openjdk-headless x86_64 1:1.8.0.322.b06-2.el8_5 appstream 34 M mssql-server x86_64 15.0.4198.2-10 packages-microsoft-com-mssql-server-2019 238 M Transaction Summary ============================================================================================================= Upgrade 4 Packages Total download size: 282 M Downloading Packages: (1/4): java-1.8.0-openjdk-1.8.0.322.b06-2.el8_5.x86_64.rpm 2.9 MB/s | 341 kB 00:00 (2/4): java-1.8.0-openjdk-devel-1.8.0.322.b06-2.el8_5.x86_64.rpm 20 MB/s | 9.8 MB 00:00 (3/4): java-1.8.0-openjdk-headless-1.8.0.322.b06-2.el8_5.x86_64.rpm 13 MB/s | 34 MB 00:02 (4/4): mssql-server-15.0.4198.2-10.x86_64.rpm 24 MB/s | 238 MB 00:10 ------------------------------------------------------------------------------------------------------------- Total 27 MB/s | 282 MB 00:10 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Running scriptlet: java-1.8.0-openjdk-headless-1:1.8.0.322.b06-2.el8_5.x86_64 1/1 Preparing : 1/1 Running scriptlet: java-1.8.0-openjdk-headless-1:1.8.0.322.b06-2.el8_5.x86_64 1/1 Upgrading : java-1.8.0-openjdk-headless-1:1.8.0.322.b06-2.el8_5.x86_64 1/8 Running scriptlet: java-1.8.0-openjdk-headless-1:1.8.0.322.b06-2.el8_5.x86_64 1/8 Upgrading : java-1.8.0-openjdk-1:1.8.0.322.b06-2.el8_5.x86_64 2/8 Running scriptlet: java-1.8.0-openjdk-1:1.8.0.322.b06-2.el8_5.x86_64 2/8 Upgrading : java-1.8.0-openjdk-devel-1:1.8.0.322.b06-2.el8_5.x86_64 3/8 Running scriptlet: java-1.8.0-openjdk-devel-1:1.8.0.322.b06-2.el8_5.x86_64 3/8 Running scriptlet: mssql-server-15.0.4198.2-10.x86_64 4/8 Upgrading : mssql-server-15.0.4198.2-10.x86_64 4/8 Running scriptlet: mssql-server-15.0.4198.2-10.x86_64 4/8 Cleanup : java-1.8.0-openjdk-devel-1:1.8.0.312.b07-2.el8_5.x86_64 5/8 Running scriptlet: java-1.8.0-openjdk-devel-1:1.8.0.312.b07-2.el8_5.x86_64 5/8 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/bin/javac has not been configured as an alternative for javac /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64 has not been configured as an alternative for java_sdk_openjdk /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64 has not been configured as an alternative for java_sdk_1.8.0 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64 has not been configured as an alternative for java_sdk_1.8.0_openjdk Cleanup : mssql-server-15.0.4188.2-3.x86_64 6/8 Running scriptlet: mssql-server-15.0.4188.2-3.x86_64 6/8 Cleanup : java-1.8.0-openjdk-1:1.8.0.312.b07-2.el8_5.x86_64 7/8 Running scriptlet: java-1.8.0-openjdk-1:1.8.0.312.b07-2.el8_5.x86_64 7/8 Cleanup : java-1.8.0-openjdk-headless-1:1.8.0.312.b07-2.el8_5.x86_64 8/8 Running scriptlet: java-1.8.0-openjdk-headless-1:1.8.0.312.b07-2.el8_5.x86_64 8/8 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java has not been configured as an alternative for java /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre has not been configured as an alternative for jre_openjdk /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre has not been configured as an alternative for jre_1.8.0 /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64 has not been configured as an alternative for jre_1.8.0_openjdk warning: %postun(java-1.8.0-openjdk-headless-1:1.8.0.312.b07-2.el8_5.x86_64) scriptlet failed, exit status 2 Error in POSTUN scriptlet in rpm package java-1.8.0-openjdk-headless Running scriptlet: java-1.8.0-openjdk-1:1.8.0.322.b06-2.el8_5.x86_64 8/8 Running scriptlet: java-1.8.0-openjdk-devel-1:1.8.0.322.b06-2.el8_5.x86_64 8/8 Running scriptlet: java-1.8.0-openjdk-headless-1:1.8.0.312.b07-2.el8_5.x86_64 8/8 Verifying : java-1.8.0-openjdk-1:1.8.0.322.b06-2.el8_5.x86_64 1/8 Verifying : java-1.8.0-openjdk-1:1.8.0.312.b07-2.el8_5.x86_64 2/8 Verifying : java-1.8.0-openjdk-devel-1:1.8.0.322.b06-2.el8_5.x86_64 3/8 Verifying : java-1.8.0-openjdk-devel-1:1.8.0.312.b07-2.el8_5.x86_64 4/8 Verifying : java-1.8.0-openjdk-headless-1:1.8.0.322.b06-2.el8_5.x86_64 5/8 Verifying : java-1.8.0-openjdk-headless-1:1.8.0.312.b07-2.el8_5.x86_64 6/8 Verifying : mssql-server-15.0.4198.2-10.x86_64 7/8 Verifying : mssql-server-15.0.4188.2-3.x86_64 8/8 Upgraded: java-1.8.0-openjdk-1:1.8.0.322.b06-2.el8_5.x86_64 java-1.8.0-openjdk-devel-1:1.8.0.322.b06-2.el8_5.x86_64 java-1.8.0-openjdk-headless-1:1.8.0.322.b06-2.el8_5.x86_64 mssql-server-15.0.4198.2-10.x86_64 Complete! # 2. check version [root@thermalite ~]# java -version openjdk version "1.8.0_322" OpenJDK Runtime Environment (build 1.8.0_322-b06) OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode) [root@thermalite ~]# # 3. update openjava version to 11 [root@thermalite ~]# dnf install java-11-openjdk-devel -y Repository packages-microsoft-com-prod is listed more than once in the configuration Last metadata expiration check: 0:00:21 ago on Sat 29 Jan 2022 09:16:15 AM EST. Dependencies resolved. ============================================================================================================= Package Architecture Version Repository Size ============================================================================================================= Installing: java-11-openjdk-devel x86_64 1:11.0.14.0.9-2.el8_5 appstream 3.4 M Installing dependencies: java-11-openjdk x86_64 1:11.0.14.0.9-2.el8_5 appstream 266 k java-11-openjdk-headless x86_64 1:11.0.14.0.9-2.el8_5 appstream 40 M Transaction Summary ============================================================================================================= Install 3 Packages Total download size: 43 M Installed size: 177 M Downloading Packages: (1/3): java-11-openjdk-11.0.14.0.9-2.el8_5.x86_64.rpm 1.1 MB/s | 266 kB 00:00 (2/3): java-11-openjdk-devel-11.0.14.0.9-2.el8_5.x86_64.rpm 7.7 MB/s | 3.4 MB 00:00 (3/3): java-11-openjdk-headless-11.0.14.0.9-2.el8_5.x86_64.rpm 15 MB/s | 40 MB 00:02 ------------------------------------------------------------------------------------------------------------- Total 16 MB/s | 43 MB 00:02 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Running scriptlet: java-11-openjdk-headless-1:11.0.14.0.9-2.el8_5.x86_64 1/1 Preparing : 1/1 Installing : java-11-openjdk-headless-1:11.0.14.0.9-2.el8_5.x86_64 1/3 Running scriptlet: java-11-openjdk-headless-1:11.0.14.0.9-2.el8_5.x86_64 1/3 Installing : java-11-openjdk-1:11.0.14.0.9-2.el8_5.x86_64 2/3 Running scriptlet: java-11-openjdk-1:11.0.14.0.9-2.el8_5.x86_64 2/3 Installing : java-11-openjdk-devel-1:11.0.14.0.9-2.el8_5.x86_64 3/3 Running scriptlet: java-11-openjdk-devel-1:11.0.14.0.9-2.el8_5.x86_64 3/3 Running scriptlet: java-11-openjdk-1:11.0.14.0.9-2.el8_5.x86_64 3/3 Running scriptlet: java-11-openjdk-devel-1:11.0.14.0.9-2.el8_5.x86_64 3/3 Verifying : java-11-openjdk-1:11.0.14.0.9-2.el8_5.x86_64 1/3 Verifying : java-11-openjdk-devel-1:11.0.14.0.9-2.el8_5.x86_64 2/3 Verifying : java-11-openjdk-headless-1:11.0.14.0.9-2.el8_5.x86_64 3/3 Installed: java-11-openjdk-1:11.0.14.0.9-2.el8_5.x86_64 java-11-openjdk-devel-1:11.0.14.0.9-2.el8_5.x86_64 java-11-openjdk-headless-1:11.0.14.0.9-2.el8_5.x86_64 Complete! # 4. use alternative to set the default version [root@thermalite ~]# alternatives --config java There are 2 programs which provide 'java'. Selection Command ----------------------------------------------- *+ 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-2.el8_5.x86_64/jre/bin/java) 2 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.14.0.9-2.el8_5.x86_64/bin/java) Enter to keep the current selection[+], or type selection number: 2 # 5. check version [malex@thermalite ~]$ java -version openjdk version "11.0.14" 2022-01-18 LTS OpenJDK Runtime Environment 18.9 (build 11.0.14+9-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.14+9-LTS, mixed mode, sharing) [malex@thermalite ~]$ # 6. setting the JAVA_HOME Environment variable [root@thermalite ~]# vi /etc/profile.d/java.sh [root@thermalite ~]# cat /etc/profile.d/java.sh JAVA_HOME="/usr/lib/jvm/java-11-openjdk-11.0.14.0.9-2.el8_5.x86_64" [root@thermalite ~]# source /etc/profile.d/java.sh [root@thermalite ~]# echo $JAVA_HOME /usr/lib/jvm/java-11-openjdk-11.0.14.0.9-2.el8_5.x86_64 [malex@thermalite ~]$ java -version openjdk version "11.0.14" 2022-01-18 LTS OpenJDK Runtime Environment 18.9 (build 11.0.14+9-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.14+9-LTS, mixed mode, sharing) [malex@thermalite ~]$
Saturday, January 29, 2022
How to Install/Upgrade Java on CentOS 8/Rocky Linux 8
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment