Preparatory work:
1. Download jdk-8u73-linux-x64.tar.gz from Oracle official website using wget
2. Tar tool (CentOS7 Minimal contains this tool by default)
3, Nano (small text editor, single function, but small, all kinds of commands are prompted, unlike VI, Operation needs to turn manual)
User preparation:
1, switch to the root user (if not switch, see here)
Steps:
Suppose we save the JDK installation file under the ~/software/to extract it to/opt/java/.
0. Observe the installation package file to determine its structure
Tar tf ~/software/jdk-8u73-linux-x64.tar.gz
With this command above, we can see that the directory structure in the installation package is relatively simple, and the GZ file contains only one folder jdk1.8.0_73. So, we just need to unzip the installation package and get this folder directly.
1. Create the target directory
mkdir/opt/java/
2. Enter the/opt/java/directory
Cd/opt/java
3. Unpack the installation package
Tar zxvf/home/rrrrr/software/jdk-8u73-linux-x64.tar.gz
4, see if it is/opt/java below a directory jdk1.8.0_73
5. Setting environment variables for JDK
Nano/home/rrrrr/.bash_profile
Go to the Nano editor. Add the following information in the editor:
Export Java_home=/opt/java/jdk1.8.0_73export jre_home=/opt/java/jdk1.8.0_73/jreexport PATH= $PATH: $JAVA _home/bin:$ Jre_home/bin
Press Ctrl+o, then enter, then ctrl+x exit Nano
6, immediately apply the 5th step to configure the information
Source/home/rrrrr/.bash_profile
7. Testing
Java-version
This article is from the "Bitterjava" blog, make sure to keep this source http://rickqin.blog.51cto.com/1096449/1755062
CentOS7, installing the jdk1.8u73 in GZ format