How to install Java jdk 11 on RHEL

In this article, we will see how to install Java jdk 11 on RHEL step by step.

How to install Java jdk 11 on RHEL

1. First, verify java jdk is installed or not using the below command.

java --version

How to install Java jdk 11 on RHEL

2. Now update the RHEL using the below command.

sudo yum update

3. Install java jdk 11 on RHEL 11 by running the below command:

sudo yum install java-11-openjdk

If it asks to download, then type y and hit enter.

[administrator@system1 ~]$ sudo yum install java-11-openjdk Updating Subscription Management repositories. Last metadata expiration check: 0:04:11 ago on Thu 12 Jan 2023 12:15:42 PM IST. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: java-11-openjdk x86_64 1:11.0.17.0.8-2.el9_0 rhel-9-for-x86_64-appstream-rpms 249 k Installing dependencies: copy-jdk-configs noarch 4.0-3.el9 rhel-9-for-x86_64-appstream-rpms 29 k java-11-openjdk-headless x86_64 1:11.0.17.0.8-2.el9_0 rhel-9-for-x86_64-appstream-rpms 38 M javapackages-filesystem noarch 6.0.0-3.el9 rhel-9-for-x86_64-appstream-rpms 18 k lksctp-tools x86_64 1.0.19-2.el9 rhel-9-for-x86_64-baseos-rpms 98 k lua x86_64 5.4.2-4.el9_0.3 rhel-9-for-x86_64-appstream-rpms 191 k lua-posix x86_64 35.0-8.el9 rhel-9-for-x86_64-appstream-rpms 155 k mkfontscale x86_64 1.2.1-3.el9 rhel-9-for-x86_64-appstream-rpms 34 k ttmkfdir x86_64 3.0.9-65.el9 rhel-9-for-x86_64-appstream-rpms 55 k tzdata-java noarch 2022g-1.el9_1 rhel-9-for-x86_64-appstream-rpms 234 k xorg-x11-fonts-Type1 noarch 7.5-33.el9 rhel-9-for-x86_64-appstream-rpms 509 k Transaction Summary ================================================================================ Install 11 Packages Total download size: 40 M Installed size: 175 M Is this ok [y/N]: y Downloading Packages: (1/11): lua-posix-35.0-8.el9.x86_64.rpm 312 kB/s | 155 kB 00:00 (2/11): copy-jdk-configs-4.0-3.el9.noarch.rpm 57 kB/s | 29 kB 00:00 (3/11): mkfontscale-1.2.1-3.el9.x86_64.rpm 74 kB/s | 34 kB 00:00 (4/11): lksctp-tools-1.0.19-2.el9.x86_64.rpm 80 kB/s | 98 kB 00:01 (5/11): javapackages-filesystem-6.0.0-3.el9.noa 57 kB/s | 18 kB 00:00 (6/11): java-11-openjdk-11.0.17.0.8-2.el9_0.x86 642 kB/s | 249 kB 00:00 (7/11): ttmkfdir-3.0.9-65.el9.x86_64.rpm 32 kB/s | 55 kB 00:01 (8/11): lua-5.4.2-4.el9_0.3.x86_64.rpm 293 kB/s | 191 kB 00:00 (9/11): tzdata-java-2022g-1.el9_1.noarch.rpm 499 kB/s | 234 kB 00:00 (10/11): xorg-x11-fonts-Type1-7.5-33.el9.noarch 188 kB/s | 509 kB 00:02 (11/11): java-11-openjdk-headless-11.0.17.0.8-2 3.3 MB/s | 38 MB 00:11 -------------------------------------------------------------------------------- Total 3.0 MB/s | 40 MB 00:12 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Running scriptlet: copy-jdk-configs-4.0-3.el9.noarch 1/1 Running scriptlet: java-11-openjdk-headless-1:11.0.17.0.8-2.el9_0.x86_6 1/1 Preparing : 1/1 Installing : tzdata-java-2022g-1.el9_1.noarch 1/11 Installing : lua-5.4.2-4.el9_0.3.x86_64 2/11 Installing : javapackages-filesystem-6.0.0-3.el9.noarch 3/11 Installing : ttmkfdir-3.0.9-65.el9.x86_64 4/11 Installing : mkfontscale-1.2.1-3.el9.x86_64 5/11 Installing : xorg-x11-fonts-Type1-7.5-33.el9.noarch 6/11 Running scriptlet: xorg-x11-fonts-Type1-7.5-33.el9.noarch 6/11 Installing : lua-posix-35.0-8.el9.x86_64 7/11 Installing : copy-jdk-configs-4.0-3.el9.noarch 8/11 Installing : lksctp-tools-1.0.19-2.el9.x86_64 9/11 Installing : java-11-openjdk-headless-1:11.0.17.0.8-2.el9_0.x86 10/11 Running scriptlet: java-11-openjdk-headless-1:11.0.17.0.8-2.el9_0.x86 10/11 Installing : java-11-openjdk-1:11.0.17.0.8-2.el9_0.x86_64 11/11 Running scriptlet: java-11-openjdk-1:11.0.17.0.8-2.el9_0.x86_64 11/11 Running scriptlet: copy-jdk-configs-4.0-3.el9.noarch 11/11 Running scriptlet: java-11-openjdk-headless-1:11.0.17.0.8-2.el9_0.x86 11/11 Running scriptlet: java-11-openjdk-1:11.0.17.0.8-2.el9_0.x86_64 11/11 Verifying : lksctp-tools-1.0.19-2.el9.x86_64 1/11 Verifying : copy-jdk-configs-4.0-3.el9.noarch 2/11 Verifying : lua-posix-35.0-8.el9.x86_64 3/11 Verifying : mkfontscale-1.2.1-3.el9.x86_64 4/11 Verifying : ttmkfdir-3.0.9-65.el9.x86_64 5/11 Verifying : javapackages-filesystem-6.0.0-3.el9.noarch 6/11 Verifying : java-11-openjdk-1:11.0.17.0.8-2.el9_0.x86_64 7/11 Verifying : xorg-x11-fonts-Type1-7.5-33.el9.noarch 8/11 Verifying : java-11-openjdk-headless-1:11.0.17.0.8-2.el9_0.x86 9/11 Verifying : lua-5.4.2-4.el9_0.3.x86_64 10/11 Verifying : tzdata-java-2022g-1.el9_1.noarch 11/11 Installed products updated. Installed: copy-jdk-configs-4.0-3.el9.noarch java-11-openjdk-1:11.0.17.0.8-2.el9_0.x86_64 java-11-openjdk-headless-1:11.0.17.0.8-2.el9_0.x86_64 javapackages-filesystem-6.0.0-3.el9.noarch lksctp-tools-1.0.19-2.el9.x86_64 lua-5.4.2-4.el9_0.3.x86_64 lua-posix-35.0-8.el9.x86_64 mkfontscale-1.2.1-3.el9.x86_64 ttmkfdir-3.0.9-65.el9.x86_64 tzdata-java-2022g-1.el9_1.noarch xorg-x11-fonts-Type1-7.5-33.el9.noarch Complete!

4. Now verify again, java installed or not by running below command.

java --version

5. Now, install the Java Development Kit with the following command:

sudo yum install java-11-openjdk-devel

How to set JAVA_HOME environment variable:

1. First, locate where Java is installed:

sudo update-alternatives --config java

2. Once you see all the paths, copy the one of your preferred Java version.

3. Then, open the .bash_profile with any text editor. In this example, we use vim:

vim .bash_profile

4. At the bottom of the file, add a line which specifies the location of JAVA_HOME in the following manner:

JAVA_HOME=”/your/installation/path/”

Command ‘curl’ not found on Ubuntu or Debian or Mac

In this article, we find resolution for the error Command ‘curl’ not found on Ubuntu or Debian or Mac.

Command 'curl' not found, but can be installed with: sudo snap install curl # version 7.86.0, or sudo apt install curl # version 7.81.0-1ubuntu1.6 See 'snap info curl' for additional versions. Command 'curl' not found, but can be installed with: sudo snap install curl # version 7.86.0, or sudo apt install curl # version 7.81.0-1ubuntu1.6 See 'snap info curl' for additional versions

Command 'curl' not found on Ubuntu or Debian or Mac
Continue reading Command ‘curl’ not found on Ubuntu or Debian or Mac

The command could not be located because is not included in the PATH environment variable

In this article, we will find the solution for following error message.

Command 'cat' is available in the following places * /bin/cat * /usr/bin/cat The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable. cat: command not found

The command could not be located because is not included in the PATH environment variable

Reason: Continue reading The command could not be located because is not included in the PATH environment variable

How to install locate command in Linux

In this article, we will see how to install locate command in Linux.

The locate is a command line utility for finding files by name in Linux, just like find command. However, it works more efficiently compared to its counterpart; it uses one or more databases populated by the updatedb program and prints file names matching at least one of the patterns (a user provides) to standard output.

By default, locate command is not installed. When we tried to run locate command from Linux terminal, we will receive below error.

Command 'locate' not found, but can be installed with: sudo apt install mlocate

Install locate command in Linux

Run the below command on your terminal.

sudo apt-get install mlocate

Output of above command is:

[sudo] password for r2schools: Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: nocache The following NEW packages will be installed: mlocate 0 upgraded, 1 newly installed, 0 to remove and 146 not upgraded. Need to get 50.1 kB of archives. After this operation, 258 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu focal/main amd64 mlocate amd64 0.26-3u buntu3 [50.1 kB] Fetched 50.1 kB in 1s (69.4 kB/s) Selecting previously unselected package mlocate. (Reading database ... 196023 files and directories currently installed.) Preparing to unpack .../mlocate_0.26-3ubuntu3_amd64.deb ... Unpacking mlocate (0.26-3ubuntu3) ... Setting up mlocate (0.26-3ubuntu3) ... update-alternatives: using /usr/bin/mlocate to provide /usr/bin/locate (locate) in auto mode Adding group `mlocate' (GID 135) ... Done. Initializing mlocate database; this may take some time... done Processing triggers for man-db (2.9.1-1) ...

So, now you can find files or folders using Linux locate command.