First, copy the package to the first jdk compression system, I have here is placed under the directory / server
How to copy files to the Linux system itself Baidu
Second, enter the command tar -xzvf jdk1.8.0_171 extracting archive, then rm -rf jdk1.8.0_171 delete archive to save space
Third, configure the environment variables, vi / etc / profile, enter the profile file, enter i to enter edit mode, adding three variables at the bottom, esc to exit edit mode, enter: wq to save and exit
export JAVA_HOME=/server/jdk1.8.0_171
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH