How to install Java 17 on Rocky Linux 8 / Alma Linux 8

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to install Java 17 LTS on Rocky Linux 8 / Alma Linux 8. This is the latest LTS version of Java, and it is always good to have a robust and robust version that is also LTS.

Java 17 LTS, is it a good idea to have it installed?

Java 17 is the latest LTS version of this programming language and software platform. With this version, programmers will have a solid base to develop their applications and sysadmins will have a base to deploy them.

For this post, we did not use the Oracle version but the OpenJDK, which is easier to install and does the job.

In addition to this, the OpenJDK version has no licensing problems, so we can use it in a variety of different projects.

So let’s go for it.

Install OpenJDK on Rocky Linux 8 / Alma Linux 8

First, open a terminal and make sure the system is up-to-date.

sudo dnf update

Thereafter, install some packages needed to complete the post.

sudo dnf install nano wget 

Now download OpenJDK 17 as follows:

wget https://download.java.net/java/GA/jdk17/0d483333a00540d886896bac774ff48b/35/GPL/openjdk-17_linux-x64_bin.tar.gz
1.- Download and install Java 17 on Rocky Linux 8 / Alma Linux 8
1.- Download and install Java 17 on Rocky Linux 8 / Alma Linux 8

Then, unzip the archive as follows:

tar xvf openjdk-17_linux-x64_bin.tar.gz

Then, move it to a folder like /opt/.

sudo mv jdk-17 /opt/

Now, to use Java without issues, it is necessary to add the path to the PATH.

sudo nano /etc/profile.d/jdk.sh

And add the following content

export $JAVA_HOME=/opt/jdk-17
export PATH=$PATH:$JAVA_HOME/bin

Save the changes and close the editor.

Apply the changes by executing the following command

source /etc/profile.d/jdk.sh

And now you can check them as follows

java --version
openjdk 17 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

So with this easy way, we can have them available.

Conclusion

In this post, you have learned how to install Java 17 LTS on Rocky Linux even though it is a short post, it is important for many to have the latest LTS version available.

I hope you liked it and share the post.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook