AlmaLinux or RockyLinux are enterprise Linux working techniques and ideal decisions for internet hosting or working server functions. They are free and open supply, so anybody can use them to arrange their Linux infrastructure. However, the default Java out there via 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 immediately utilizing the DNF package deal supervisor of Almalinux or Rocky as a result of it isn’t current there, therefore, go to the official web site and obtain the JDK or JRE 8 no matter you need 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 might have 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 situated 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 might have made the information 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 affirm, whether or not the model of Java you might have put in is in your system or not, we will use the given command.
However, when you’ve got 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, when you’ve got a number of model together with Oracle Java 8 then to configure it because the system huge 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 also ask you which ones model of it you need to be the default. Enter the Selection quantity and hit the enter key.
Similary, these need to change the Java Compiler – Javac as effectively 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 utterly take away it from AlmaLinux or Rocky, run the given command:
sudo dnf take away jdk-1.8