1、shell脚本安装jdk提前把jdk安装包放在 /usr/local 下[root@bogon ~]# cat jdk.sh #!/bin/bashcd /usr/local/ && tar xf jdk-8u171-linux-x64.tar.gzcat >> /etc/profile << EOFexport JAVA_HOME=/usr/local/jdk1.8.0_171/export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/binEOFsource /etc/profile && java -version ./jdk.sh