# 一、yum方式安装
代码语言:javascript复制$ yum install java-1.8.0-openjdk* -y
# 二、下载安装包安装jdk
下载linux环境下的jdk1.8,请去官网下载jdk的安装文件
oracle官网 (opens new window)
华为官网下载地址 (opens new window)
代码语言:javascript复制$ mkdir /usr/local/java/
$ tar -zxvf jdk-8u171-linux-x64.tar.gz -C /usr/local/java/
$ vim /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_171
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
$ source /etc/profile
$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)