如何在今天的Linux上自动下载和安装Java JDK?
作者:互联网
关于如何在Linux上自动下载Java JDK,有一个很好的答案:
Downloading Java JDK on Linux via wget is shown license page instead
所描述的方法不再有效.看来Oracle再次更改了对其下载服务器的限制以阻止此方法.我想他们不希望Java在自动缩放服务器系统(例如AWS)中使用.他们在想什么?
我正在尝试的特定命令是将最新的7u51版本下载到AWS服务器,以便我可以安装Web应用程序:
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2%2Fwww.oracle.com%2F" "http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm"
如封闭答案中所述,这不再绕过OTN许可协议:
https://stackoverflow.com/a/21431491/2144836
从浏览器尝试此操作,我发现下载链接正在查询参数中添加其他身份验证:
http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm?AuthParam=1392853518_cb83fe47e04500eecccdb66722756fb3
将带有AuthParam的链接复制并粘贴到wget调用中也不起作用.我最初的猜测是它与会话或IP地址相关.
尝试将其手动下载到服务器(或一天一百次到一百台服务器)是不合理的,因此我希望找到一种可以解决当前限制的解决方法.
因此,今天,有没有一种解决方法可以自动下载最新的JDK?还是我应该完全放弃Oracle?
解决方法:
您的命令对我来说很好.检查以下内容:
$ls jdk*
ls: cannot access jdk*: No such file or directory
$wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2%2Fwww.oracle.com%2F" "http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm"
--2014-02-20 14:03:49-- http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm
Resolving download.oracle.com... 23.11.235.25, 23.11.235.43
Connecting to download.oracle.com|23.11.235.25|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm [following]
--2014-02-20 14:03:50-- https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm
Resolving edelivery.oracle.com... 23.35.70.140
Connecting to edelivery.oracle.com|23.35.70.140|:443... connected.
WARNING: certificate common name `www.oracle.com' doesn't match requested host name `edelivery.oracle.com'.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm?AuthParam=1392885351_97435f8939e97d11f6065b4147ddbae9 [following]
--2014-02-20 14:03:50-- http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm?AuthParam=1392885351_97435f8939e97d11f6065b4147ddbae9
Reusing existing connection to download.oracle.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 121271382 (116M) [application/x-redhat-package-manager]
Saving to: `jdk-7u51-linux-i586.rpm'
100%[=================================================================================================================================>] 12,12,71,382 381K/s in 4m 14s
2014-02-20 14:08:04 (466 KB/s) - `jdk-7u51-linux-i586.rpm' saved [121271382/121271382]
$ls -l jdk*
-rw-r--r-- 1 root root 121271382 2014-02-11 00:10 jdk-7u51-linux-i586.rpm
运行此命令时会出现什么错误?我在3个不同的地方尝试了您的命令,并且每次都有效.
标签:amazon-web-services,linux,java 来源: https://codeday.me/bug/20191122/2056952.html