JDK安装
tar xf jdk-8u11-linux-x64.tar.gz mv jdk1.8.0_11 /usr/local/jdk vim /etc/profile
export JAVA_HOME=/usr/local/jdk export JRE_HOME=/usr/local/jdk/jre export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
. /etc/profile
[root@localhost jdk]# java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
Saltstack:
jdk-install: file.managed: - name: /usr/local/jdk-8u11-linux-x64.tar.gz - source: salt://jdk/files/jdk-8u11-linux-x64.tar.gz - user: root - group: root - mode: 644 cmd.run: - name: cd /usr/local/ && tar xf jdk-8u11-linux-x64.tar.gz && mv jdk1.8.0_11 jdk - unless: test -d /usr/local/jdk - require: - file: jdk-install /etc/profile: file.append: - text: - export JAVA_HOME=/usr/local/jdk - export JRE_HOME=/usr/local/jdk/jre - export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib - export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH cmd.run: - name: source /etc/profile && cd /usr/local && rm -rf jdk-8u11-linux-x64.tar.gz