1、下载jdk1.8
2.centos创建软件安装目录 /opt/softs
mkdir /opt/softs
3.创建软件包存放目录/opt/softpackages
/opt/softpackages
将压缩包解压到/opt/softs
4.放到环境变量中
vim /etc/profile
export JAVA_HOME=/opt/softs/jdk1.8
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
source /etc/profile
5.验证安装:
java -version