在部署生产系统时,推荐使用yun来部署java环境
1.开启epel源
#yum -y install epel-release
2.安装java
# yum -y install java-1.6*
epel源目前安装的是1.6版本
3.升级java版
(1).启用epel测试源
编辑vi /etc/yum.repos.d/epel-testing.repo
[epel-testing]
name=Extra Packages for Enterprise Linux 6 - Testing - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/testing/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-epel6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6(2).停用epel正常源
# vi /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6(3).升级java版本
# yum -y install java-1.7*
注意:yum升级时不能跨级升级java,不能直接从1.6升级到1.7
原文地址:http://blog.csdn.net/jacson_bai/article/details/44853861