AlmaLinux or RockyLinux are enterprise Linux working techniques and excellent decisions for internet hosting or operating server functions. They are free and open supply, so anybody can use them to arrange their Linux infrastructure. However, the default Java obtainable by their repositories is OpenJDK which is an open-source version of Oracle Java. Therefore, for many who are on the lookout for instructions for putting in Oracle Java model 8 which is long-term supported both on Almalinux or Rocky Linux 8/9, then on this tutorial, we learn to try this.
Step 1: Download Oracle Java 8
We can’t get Oracle Java 8 straight utilizing the DNF package deal supervisor of Almalinux or Rocky as a result of it’s not current there, therefore, go to the official web site and obtain the JDK or JRE 8 no matter you wish to install as per your system structure (x64 or x86). Here, we’re downloading the 64-bit model.
Step 2: Change file Permission to execute it
Once you’ve downloaded the file and it’s on the system, let’s change its permission to execute and install Java 8 with none drawback.
Switch to the listing the place the file is positioned and run:
sudo chmod a+x file-name
sudo chmod a+x jdk-8u*-linux-x64.rpm
Step 3: Install Oracle JDK 8 on Almalinux or RockyLinux
Once you’ve made the recordsdata executable, use the RPM command to install the JDK or JRE 8 on the system.
sudo rpm -ivh jdk-8u*-linux-x64.rpm
Step 4: Check Version
To verify, whether or not the model of Java you’ve put in is in your system or not, we will use the given command.
However, you probably have a number of variations of Java put in then the most recent and default one will seem in the results of the above command. Hence, to make the Oracle Java 8 your system’s default model,if not already, observe the following step.
Step 5: Update Alternatives
Updat the Alternatives to set the default model of Java as per your venture. For instance, you probably have a number of model together with Oracle Java 8 then to configure it because the system vast default use the given command:
sudo update-alternatives --config java
The above command will listing the put in variations of Java in your Linux system. It may even ask you which of them model of it you wish to be the default. Enter the Selection quantity and hit the enter key.
Similary, these wish to change the Java Compiler – Javac as nicely can use the next command:
sudo update-alternatives --config javac
Uninstallating Java, if required
If there are circumstances, whenever you don’t require Oracle Java 8 in your system then to fully take away it from AlmaLinux or Rocky, run the given command:
sudo dnf take away jdk-1.8