mirror of
https://github.com/dunwu/linux-tutorial.git
synced 2024-04-15 19:55:24 +08:00
40 lines
1.0 KiB
Bash
40 lines
1.0 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
###################################################################################
|
|
# 控制台颜色
|
|
BLACK="\033[1;30m"
|
|
RED="\033[1;31m"
|
|
GREEN="\033[1;32m"
|
|
YELLOW="\033[1;33m"
|
|
BLUE="\033[1;34m"
|
|
PURPLE="\033[1;35m"
|
|
CYAN="\033[1;36m"
|
|
RESET="$(tput sgr0)"
|
|
###################################################################################
|
|
|
|
printf "${BLUE}"
|
|
cat << EOF
|
|
|
|
###################################################################################
|
|
# 安装 JDK8 脚本
|
|
# JDK 会被安装到 /usr/lib/jvm/java 路径。
|
|
# @system: 适用于 CentOS
|
|
# @author: Zhang Peng
|
|
###################################################################################
|
|
|
|
EOF
|
|
printf "${RESET}"
|
|
|
|
printf "${BLUE}>>>>>>>> install jdk8\n${RESET}"
|
|
|
|
command -v yum >/dev/null 2>&1 || {
|
|
printf "${RED}Require yum but it's not installed. Aborting.\n${RESET}"
|
|
echo >&2 "Require yum but it's not installed. Aborting.";
|
|
exit 1;
|
|
}
|
|
|
|
yum -y install java-1.8.0-openjdk-devel.x86_64
|
|
java -version
|
|
|
|
printf "${GREEN}<<<<<<<< install jdk8 finished\n${RESET}"
|