1 . Uninstall the existing the JDK ( 1 ) check whether the installed Java software: [atguigu @ hadoop101 opt] $ RPM -qa | grep the Java ( 2 ) if the installed version is less than 1. 7 , uninstall the JDK: [opt atguigu @ hadoop101 ] $ the sudo RPM - E package ( 3 ) See JDK installation path: [atguigu hadoop101 @ ~ ] Which Java $ 2 with a tool SecureCRT JDK opt into the directory software folder, as shown in FIG. 2- 28 2 - 28 introduced into the JDK "Alt + P" enter sftp mode, as shown in FIG 2- 29 2 - 29 enters sftp mode selection jdk1.8 drag, 2 - 30 , 2- 31 2 - 30 drag jdk1. . 8 Figure 2 - 31 is dragged jdk1.8 completed 3 to see if the package successfully imported opt directory under the Linux system. [Atguigu @ hadoop101 opt] Software CD $ / [ Software @ hadoop101 atguigu] $ LS Hadoop - 2.7 . 2 .tar.gz JDK-8u144-Linux- x64.tar.gz . 4 . JDK decompression to / opt / next directory module [atguigu @ hadoop101 Software] $ the tar -zxvf JDK - -C-Linux-x64.tar.gz 8u144 / opt / Module1 / . 5 . JDK environment variable configuration ( 1 ) to obtain the JDK path [atguigu @ hadoop101 jdk1. . 8 .0_144] $ pwd / opt / Module1 / jdk1. . 8 .0_144 ( 2 ) open / etc / profile file [atguigu @ hadoop101 Software] $ the sudo VI / etc / profile is added in the end of the path profile file JDK #JAVA_HOME Export the JAVA_HOME = / opt / Module1 / jdk1 . 8 .0_144 Export the PATH = $ the PATH: $ JAVA_HOME / bin ( 3 ) after saving exit : WQ ( 4 ) file after the change to take effect [atguigu @ hadoop101 jdk1. 8 .0_144] $ Source / etc / Profile 6 test. JDK is installed successfully [atguigu @ hadoop101 jdk1. 8 .0_144] # the Java - Version the Java Version" 1.8.0_144 " Note: Restart (if the Java - Version can be used would not restart) [atguigu @ hadoop101 jdk1. 8 .0_144] $ Sync [atguigu @ hadoop101 jdk1. 8 .0_144] $ sudo reboot