1 Uninstall the built-in JDK
Uninstall the JDK that comes with the virtual machine. This step is not required if the virtual machine is minimally installed.
rpm -qa | grep -i java | xargs -n1 rpm -e --nodeps
Note: Before installing the JDK, make sure to delete the JDK that comes with the virtual machine in advance.
2 Install the JDK
If you want to transfer files from Windows to Linux, you don’t need to enable Xftp. You just need to open the path in XShell to the location you want to transfer to, and drag the file directly to the XShell interface to send it.
eg Import JDK to software
1. Enter the software directory
2. Drag the file to the interface
3. A prompt of successful transfer appears
1) Check whether the software package is imported successfully in the software directory under the Linux system
[root@Linux2 software]# ls
jdk-8u212-linux-x64.tar.gz
jdk-8u212-linux-x64.tar.gz resource
link: https://pan.baidu.com/s/1kUyZR0LV9mzIX0p0A8mkMA?pwd=v8hm
Extraction code: v8hm
– share from Baidu Netdisk super member V5
2) Decompress the JDK to
the decompression statement of the *.tar.gz file in the /opt/module directory
tar -zxvf *.tar.gz -C [解压文件存放的地方]
Practical
tar -zxvf jdk-8u212-linux-x64.tar.gz -C /opt/module/
3) Configure JDK environment variables
(1) Create a new /etc/profile.d/my_env.sh file
sudo vim /etc/profile.d/my_env.sh
Add the following content
#JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_212
export PATH=$PATH:$JAVA_HOME/bin
(2) source /etc/profile file, let the new environment variable PATH take effect
source /etc/profile
4) Test whether the JDK is installed successfully
[lord@hadoop102 ~]$ java -version
java version "1.8.0_212"