2018-02-23 17:27:21 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
###################################################################################
|
|
|
|
# 安装 JDK8 脚本
|
|
|
|
# 适用于所有 linux 发行版本。
|
2018-09-29 10:16:24 +08:00
|
|
|
# JDK 会被安装到 /opt/java/jdk1.8.0_162 路径。
|
2018-02-23 17:27:21 +08:00
|
|
|
# Author: Zhang Peng
|
|
|
|
###################################################################################
|
2018-02-01 16:34:02 +08:00
|
|
|
|
2018-02-01 17:47:13 +08:00
|
|
|
echo -e "\n>>>>>>>>> install jdk8"
|
|
|
|
|
2018-09-29 10:16:24 +08:00
|
|
|
mkdir -p /opt/java
|
|
|
|
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" -O /opt/java/jdk-8u162-linux-x64.tar.gz http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/jdk-8u162-linux-x64.tar.gz
|
2018-02-23 17:27:21 +08:00
|
|
|
|
2018-09-29 10:16:24 +08:00
|
|
|
cd /opt/java
|
2018-02-23 17:27:21 +08:00
|
|
|
tar -zxvf jdk-8u162-linux-x64.tar.gz
|
2018-02-01 16:34:02 +08:00
|
|
|
|
2018-02-02 17:53:50 +08:00
|
|
|
cat >> /etc/profile << EOF
|
2018-02-23 17:27:21 +08:00
|
|
|
|
2018-09-29 10:16:24 +08:00
|
|
|
export JAVA_HOME=/opt/java/jdk1.8.0_162
|
2018-02-23 17:27:21 +08:00
|
|
|
export PATH=\$JAVA_HOME/bin:\$PATH
|
|
|
|
export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar
|
2018-02-01 16:34:02 +08:00
|
|
|
EOF
|
2018-02-02 17:53:50 +08:00
|
|
|
source /etc/profile
|