Linux————自动安装jdk的shell脚本编写

#!/bin/sh
echo -e "First"
tar -zxf /opt/softwares/jdk-8u91-linux-x64.tar.gz -C /opt/modules/
echo -e "Second"
echo "#JAVA_HOME">>/etc/profile
echo "export JAVA_HOME=/opt/modules/jdk1.8.0_91">>/etc/profile
echo "export PATH="$"{PATH}:"$"{JAVA_HOME}/bin">>/etc/profile
echo -e "Last"
source /etc/profile
echo -e "The End!"

注意:

        需要自行将jdk压缩安装包上传,这里以jdk-8u91-linux-x64.tar.gz示例,安装包我上传到了/opt/softwares目录下,安装在/opt/modules目录下,可根据自己的要求上传、安装到相应的目录下。

转载自:
https://blog.csdn.net/superme_yong/article/details/84862689

你可能感兴趣的:(Linux)