Each feeling with this is very simple, but every time to check, after all, with the wrong point behind all the more trouble, record, convenient to view later. The installation of the JDK under Linux is the same as the installation under Windows, before the installation of Windows is the first download of the compressed package, and then configure the environment variables. In fact, under Linux is the same.First step: Create a JDK installation directory(The/USR/LOCAL/SRC directory is empty, it is best to put our own download to this, easy to distinguish) command: Mkdir-p/usr/local/src/jdkStep Two: View the Setup programCommand: RPM-QA | Grep-i JDK If you have previously installed the JDK, the next installation must be removed before the cleanStep three: command to download the JDK package(Need networking, the download will take some time) This chapter uses a file with the suffix tar.gz (no installation required), such as the jdk-8u131-linux-x64.tar.gz command: [[email protected] jdk]# wget--no-check -certificate--no-cookies--header "Cookie:oraclelicense=accept-securebackup-cookie" http://download.oracle.com/ Otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gzNote: If the above wget command can not be used, error:-bash:wget:command not found. Execute the command (install dependent packages)yum-y Install wgetNote: Remember to add:--no-check-certificate--no-cookies--header "Cookie:oraclelicense=accept-securebackup-cookie" This section is designed to avoid user authentication.Fourth step: Unzip[[email protected] jdk]# TAR-ZXVF jdk-8u131-linux-x64.tar.gz The system generates a folder named: jdk1.8.0_131. You can use the MV command to customize the file name. [Email protected] jdk]# MV jdk1.8.0_131 jdk1.8Fifth Step: Configure environment Variables[[email protected] bin]# Vi/etc/profile can see the contents of this file, the profile file is somewhat similar to the configuration of environment variables inside the Windows system, SHIFT + G is positioned to the last line This time click the A or I key, into the middle of the editing mode with a red coil up is required (Java_home is the JDK installation directory, and under Windows configuration)
export java_home=/usr/local/src/jdk/jdk1.8
export path= $PATH: $JAVA _home/bin
Sixth step: Exit the file, savePress the ESC key to enter: Wq Save and exitSeventh Step: Let the configuration file take effect[Email protected] jdk]# Source/etc/profileEighth step: see if the configuration is successful[[email protected] java1.8]# Java-version If the JDK version number appears, install and configure the environment variable successfully if the prompt command cannot be found, check the JDK configuration path for errors.
Linux installation jdk1.8 and configuration environment variables