1:查看yum库中的Java安装包
[root@localhost ~]#yum -y list java*
2:使用yum安装openjdk
[root@localhost ~]#yum -y install java-1.7.0-openjdk*
3:查看java版本
[root@localhost ~]# java -version
到此处openjdk安装完毕!
安装sun 版本jdk
1:查看linux中是否已安装jdk
[root@localhost ~]# rpm -qa | grep java
java-1.7.0-openjdk-javadoc-1.7.0.91-2.6.2.2.el6_7.noarch
java-1.7.0-openjdk-1.7.0.91-2.6.2.2.el6_7.x86_64
tzdata-java-2015g-2.el6.noarch
java-1.7.0-openjdk-src-1.7.0.91-2.6.2.2.el6_7.x86_64
java-1.7.0-openjdk-demo-1.7.0.91-2.6.2.2.el6_7.x86_64
java-1.7.0-openjdk-devel-1.7.0.91-2.6.2.2.el6_7.x86_64
2:卸载openjdk
[root@localhost ~]# rpm -qa | grep java
java-1.7.0-openjdk-javadoc-1.7.0.91-2.6.2.2.el6_7.noarch
java-1.7.0-openjdk-1.7.0.91-2.6.2.2.el6_7.x86_64
tzdata-java-2015g-2.el6.noarch
java-1.7.0-openjdk-src-1.7.0.91-2.6.2.2.el6_7.x86_64
java-1.7.0-openjdk-demo-1.7.0.91-2.6.2.2.el6_7.x86_64
java-1.7.0-openjdk-devel-1.7.0.91-2.6.2.2.el6_7.x86_64
[root@localhost ~]# rpm -e –nodeps java-1.7.0-openjdk-javadoc-1.7.0.91-2.6.2.2.el6_7.noarch
[root@localhost ~]# rpm -e –nodeps java-1.7.0-openjdk-1.7.0.91-2.6.2.2.el6_7.x86_64
[root@localhost ~]# rpm -e –nodeps tzdata-java-2015g-2.el6.noarch
[root@localhost ~]# rpm -e –nodeps java-1.7.0-openjdk-src-1.7.0.91-2.6.2.2.el6_7.x86_64
[root@localhost ~]# rpm -e –nodeps java-1.7.0-openjdk-devel-1.7.0.91-2.6.2.2.el6_7.x86_64
[root@localhost ~]# rpm -e –nodeps java-1.7.0-openjdk-demo-1.7.0.91-2.6.2.2.el6_7.x86_64
3:上传sun版本jdk到linux服务器
[root@localhost tool]# ll
total 134848
-rw-r–r–. 1 root root 138082565 Nov 15 02:53 jdk-7u79-linux-x64.rpm
4:在文件夹的目录下执行下面命令安装jdk
[root@localhost tool]# yum install jdk-7u15-linux-x64.rpm
5:查看java版本
[root@localhost ~]# java -version
附:看不懂jdk官方页面的到下面下载jdk-7u79-linux-x64.rpm
链接: http://pan.baidu.com/s/1pJN9FeV 密码: 99ey