安装JDK
- 下载JDK
mkdir /usr/java
cd /usr/java
curl -L "https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz" -H "Cookie: oraclelicense=accept-securebackup-cookie" -H "Connection: keep-alive" -O
tar -xzf jdk-8u191-linux-x64.tar.gz
- 配置环境变量
vi /etc/profile
#set java environment
JAVA_HOME=/usr/java/jdk1.8.0_191
JRE_HOME=$JAVA_HOME/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
source /etc/profile
- 系统启动自动执行
vi ·~/.bashrc
添加
source /etc/profile