一、下载JDK
JDK1.7下载:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
二、安装
1.修改文件名
[[email protected] src]# mv jdk-7u79-linux-x64.tar.gz\?AuthParam\=1473757361_a54f9f6441c4d0741a68b813b6ab1041 jdk-7u79-linux-x64.tar.gz
2.解压文件
[[email protected] src]# tar zxvf jdk-7u79-linux-x64.tar.gz
3.移动文件
[[email protected] src]# mv jdk1.7.0_79 /usr/local/
三、配置环境变量
1.编辑文件
[[email protected] local]# vim /etc/profile.d/java.sh
添加以下内容:
#!/etc/sbin/bash export JAVA_HOME=/usr/local/jdk1.7.0_79 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin |
2.刷新文件
[[email protected] local]# source /etc/profile.d/java.sh
3.查看(java版本不对执行以下操作)
[[email protected] ~]# java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
4.查看已安装java
[[email protected] ~]# yum list |grep java
[[email protected] ~]# rpm -qa |grep java
5.卸载java
[[email protected] ~]# yum remove java-1.6.0-openjdk* java-1.7.0-openjdk*java-1.8.0-openjdk*
四、所有slave安装JDK
1.传送jdk所有slave
[[email protected] src]# rsync -av /usr/local/jdk1.7.0_79 slave1:/usr/local/
[[email protected] src]# rsync -av /usr/local/jdk1.7.0_79 slave2:/usr/local/
[[email protected] src]# rsync -av /usr/local/jdk1.7.0_79 slave3:/usr/local/
[[email protected] src]# rsync -av /usr/local/jdk1.7.0_79 slave4:/usr/local/
[[email protected] src]# rsync -av /usr/local/jdk1.7.0_79 slave5:/usr/local/
[[email protected] src]# rsync -av /usr/local/jdk1.7.0_79 slave6:/usr/local/
2.编辑配置文件
跟上面的操作一样