25 lines
885 B
Bash
25 lines
885 B
Bash
#!/usr/bin/env bash
|
|
|
|
###################################################################################
|
|
# 安装 JDK8 脚本
|
|
# 适用于所有 linux 发行版本。
|
|
# JDK 会被安装到 /opt/java/jdk1.8.0_162 路径。
|
|
# Author: Zhang Peng
|
|
###################################################################################
|
|
|
|
echo -e "\n>>>>>>>>> install jdk8"
|
|
|
|
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
|
|
|
|
cd /opt/java
|
|
tar -zxvf jdk-8u162-linux-x64.tar.gz
|
|
|
|
cat >> /etc/profile << EOF
|
|
|
|
export JAVA_HOME=/opt/java/jdk1.8.0_162
|
|
export PATH=\$JAVA_HOME/bin:\$PATH
|
|
export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar
|
|
EOF
|
|
source /etc/profile
|