linux服务器如何升级jdk版本

linux服务器jdk版本升级 现在官方现在jdk的方法是用浏览器从oracle官网打开下载页面,点击同意license才可以下载。如果在linux服务器上如何使用 wget下载呢?
oracle 官网为我们提供了一种解决方案:在wget或者curl下载jdk的时候添加如下cookie header就可以跳过license下载jdk

Cookie: oraclelicense=accept-securebackup-cookie

升级jdk8 方法


JDK 8u131 x64

#RPM Wget 下载方式
wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm

#JRPM curl下载方式
curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm > jdk-8u112-linux-x64.rpm

#TAR GZ
wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz


JDK 8u131 32位系统


#Wget 下载方式
wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-i586.rpm

#curl下载方式
curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-i586.rpm > jdk-8u112-linux-i586.rpm

#TAR GZ
wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-i586.tar.gz

JDK 7u79 x64

#tar gz
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
# RPM Curl 下载方式
curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm > jdk-7u79-linux-x64.rpm

安装 rpm 方法

rpm -ivh jdk-8u131-linux-x64.rpm


安装以后, jdk默认目录在:

/usr/java/jdk1.8.0_131/

###备注 如何卸载已经安装jdk

#查找安装包
rpm -qa | grep jdk

java-1.6.0-openjdk-devel-1.6.0.0-1.41.1.10.4.5.alios6.x86_64
java-1.6.0-openjdk-1.6.0.0-1.41.1.10.4.5.alios6.x86_64
jdk1.8.0_131-1.8.0_131-fcs.x86_64

# 卸载
 rpm -e --nodeps jdk1.8.0_131-1.8.0_131-fcs.x86_64
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
慷慨打赏