1. Download JDK1.8
2. Upload the downloaded jdk package to the centos operating system through ssh
3. Unzip the installation package
tar -vxzf jdk-8u151-linux-x64.tar.gz
4. Edit system environment variables
vi /etc/profile
and add at the end of the file:
export JAVA_HOME=/usr/java/jdk8/jdk1.8.0_151
export PATH=$JAVA_HOME/bin:$PATH
5. Execute the command. /etc/profile
Note: There is a space between . and / here
If the current directory is /etc/, then you can directly execute ./profile, where . and / have no spaces
6. Enter java -version to test, the output is as follows, indicating that the installation is successful